Consulting

Results 1 to 5 of 5

Thread: Solved: Application.WorksheetFunction.CountIf not support in OutLook

  1. #1
    VBAX Contributor
    Joined
    Oct 2004
    Posts
    159
    Location

    Solved: Application.WorksheetFunction.CountIf not support in OutLook

    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

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    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]

  3. #3
    VBAX Contributor
    Joined
    Oct 2004
    Posts
    159
    Location
    DRJ, thanks for your quick response

    I found it was my mistake, it needs Excel.Application
    Excel.Application.WorksheetFunction.CountIf

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Glad you got it working.

    Take Care

  5. #5
    VBAX Contributor
    Joined
    Oct 2004
    Posts
    159
    Location
    DRJ

    There is no "Solved" in Thread Tools

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •