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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Global Address List from Access/Excel

Status
Not open for further replies.

ded

Programmer
Nov 3, 2000
41
0
0
GB
Does anyone know of a way in which I can access the Global Address List which Outlook 98 displays in the Address Book from Excel 97 or Access 97 so that I can produce lists of users dependant on criteria from a form or cells?

Cheers,
Duncan
 
2000..

'***************************************************************************************************
Dim myOlApp, myNameSpace, myEntity As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
MsgBox myNameSpace.AddressLists.Count
Set myGAddressList = myNameSpace.AddressLists("Global Address List")
'Set myPAddressList = myNameSpace.AddressLists("Personal Address Book") 'or so on..
MsgBox myGAddressList.AddressEntries.Count
For i = 1 To myGAddressList.AddressEntries.Count
'if in the addreess list are a number of _
adresses (at us 79000) it will be very slow.
Set myEntity = myGAddressList.AddressEntries(i)
If Left(myEntity.Name, 2) = "Ta" Then
MsgBox myEntity.Name
MsgBox myEntity.Address
End If
Next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top