Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2001
    Location
    Atlanta, Georgia, USA
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reading Outlook e-mail addresses (Visual Basic 6.0)

    This, I'm sure, is a simple thing to do, but despite having tons of samples, I can't seem to find an answer. I'd like to be able to display my list of contacts inside VB, letting the user pick a name. Once the name is selected, use that e-mail address in the program.
    My test program has been able to read a couple of addresses, but they don't seem to be from the Contacts folder.
    Does anyone have any sample code that would demonstrate this?

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Reading Outlook e-mail addresses (Visual Basic 6.0)

    <A target="_blank" HREF=http://groups.google.com/groups?hl=en&selm=934403174.16997@www.remarq.com>T his</A> looks like the code that you need, but there's no VB on my current machine, so I can't test it out. Reply back if you have problems; tomorrow, I'll be on a VB machine. Don't forget to add a reference to Outlook via the Project | References menu. HTH --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    Star Lounger
    Join Date
    Mar 2001
    Location
    Atlanta, Georgia, USA
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading Outlook e-mail addresses (Visual Basic 6.0)

    I tried that, but kept getting errors. However, it did point me in the right direction for some research. I found this subroutine which fills the bill:

    Private Sub RetrieveOutlookList()
    Set olApp = New Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    dlgAddress.Combo1.Text = "or select an e-mail address from this box."
    For Each olAL In olNS.AddressLists
    For Each olAE In olAL.AddressEntries
    dlgAddress.Combo1.AddItem olAE.Name & "(" & olAE.Address & ")"
    Next
    Next
    End Sub

    You still have to make a reference to Outlook (like before) and Outlook needs to be running.

    Brian A.

Posting Permissions

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