Results 1 to 6 of 6

Thread: What's wrong with this ?

  1. #1
    ego
    Guest

    Question What's wrong with this ?

    I have a small piece of code in which I just try to retrieve the names of all Outlook contacts and put them in a listbox.
    This gives me a runtime error '13': Type mismatch at the last line of code (Next objEntry):

    Dim objOutlook As New Outlook.Application
    Dim objNameSpace As Outlook.NameSpace
    Dim objContacts As MAPIFolder
    Dim objEntry As ContactItem


    'Get the MAPI reference
    Set objNameSpace = objOutlook.GetNamespace("MAPI")

    'Pick up the Contacts
    Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts)

    'Loop through the folders under the Inbox
    For Each objEntry In objContacts.Items
    lstfolders.AddItem objEntry.LastName
    Next objEntry


    Any idea's ???

  2. #2
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    I just tested it and it works fine. Are you refrencing the outlook 9.0 library?

  3. #3
    ego
    Guest
    Yes I have.
    Is it possible that it has something to do with the large number of
    contacts that i have ?

  4. #4
    ego
    Guest
    Yes I have.
    Is it possible that it has something to do with the large number of
    contacts that i have ?

  5. #5
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    I only had ten contacts. Send the code to someone else that has as many contacts as you and see if it crashes.

  6. #6
    New Member
    Join Date
    Jun 2001
    Posts
    1
    Change "Next objEntry" to "Next" ;-)

Posting Permissions

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



Click Here to Expand Forum to Full Width