The code works in Excel
[vba]Application.WorksheetFunction.CountIf(Range(Cells(i, 11), Cells(i, LastRow)), 0)[/vba]
It does not work in OutLook Excel.Application, why?
Sorry, Please discard this question
It needs Excel.Application
Emily
The code works in Excel
[vba]Application.WorksheetFunction.CountIf(Range(Cells(i, 11), Cells(i, LastRow)), 0)[/vba]
It does not work in OutLook Excel.Application, why?
Sorry, Please discard this question
It needs Excel.Application
Emily
Application in this case would be the Outlook Application. What did you call the Excel Application?
i.e.,
[vba]
Dim AppExcel As New Excel Application
AppExcel.WorksheetFunction.CountIf...
[/vba]
Also you will need to be more specific with the range. Do you have an Excel Spreadsheet Object?
i.e.
[vba]
Dim Wkb As Excel.Workbook
Set Wkb = AppExcel.Workbooks.Add 'Or Open
[/vba]
Then Use
[vba]
Wkb.Sheets(1).Range...
[/vba]
DRJ, thanks for your quick response
I found it was my mistake, it needs Excel.Application
Excel.Application.WorksheetFunction.CountIf
Glad you got it working.
Take Care
DRJ
There is no "Solved" in Thread Tools