Hi all,
I'm trying to figure out why the following code is producing a "object variable or with block variable not set" error.
Any help would be much appreciated.
Sub GetGALContacts()
Dim outApp As Object, outNS As Outlook.NameSpace
Dim mtxAddressList As Outlook.AddressList
Dim mtxGALEntries As AddressEntries
Dim mtxGALEntry As AddressEntry
Dim thisContact As ContactItem
Set outApp = CreateObject("Outlook.Application")
Set outNS = outApp.GetNamespace("MAPI")
Set mtxAddressList = outNS.session.AddressLists("Global Address List")
Set mtxGALEntries = mtxAddressList.AddressEntries
For Each mtxGALEntry In mtxGALEntries
'Test if this record is from sync
Set thisContact = mtxGALEntry.GetContact
MsgBox thisContact.FirstName '<--Error occurs here
Next mtxGALEntry
Set outApp = Nothing
End Sub
Thanks!
Nolan
Bookmarks