Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Address List

Status
Not open for further replies.

Yoxy99

MIS
Jul 28, 2007
23
US
Hi I was wondering if there was a way to open the address/contact list from outlook 2003 from a vb.net program. The address/contact list that I am talking about is same list that comes up when you click "To" if you have an open email message. Any help would be appreciated thanks.
 
This should work.

Code:
Sub GetContacts()
Dim i As Integer, nPos As Integer, s As String, NodX As Node

    Set OlApp = CreateObject("Outlook.Application")
    Set myNameSpace = OlApp.GetNamespace("MAPI")
    Set myGAddressList = myNameSpace.AddressLists("Global Address List")

    For i = 1 To myGAddressList.AddressEntries.Count
        nPos = InStrRev(myGAddressList.AddressEntries(i).Address, "=")
        s = Mid(myGAddressList.AddressEntries(i).Address, nPos + 1, Len(myGAddressList.AddressEntries(i).Address))
        Set NodeX = TV3.Nodes.Add(, , , s)
    Next i
    

End Sub

I hope this helps

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.

My newest novel: Wooden Warriors
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top