G
Guest
Guest
This is driving me crazy. As I see it the following code snippet should list everyone in my Outlook Contacts folder. It almost does, it seems to miss the newest entries. I'm sure it's something simple, any suggestions?
...
Dim olapp As Outlook.Application
Dim nspNameSpace As Outlook.NameSpace
Dim fldContacts As Outlook.MAPIFolder
Dim objContacts As Object
Dim objContact As Object
Dim iRow As Integer
Dim sName As String
On Error GoTo Err_Handler
Set olapp = CreateObject("Outlook.Application")
Set nspNameSpace = olapp.GetNamespace("MAPI")
Set fldContacts = nspNameSpace.GetDefaultFolder(olFolderContacts)
Set objContacts = fldContacts.Items
iRow = 1
For Each objContact In objContacts
sName = objContact.FileAs
Cells(iRow, 1).Value = sName
Next objContact
...
...
Dim olapp As Outlook.Application
Dim nspNameSpace As Outlook.NameSpace
Dim fldContacts As Outlook.MAPIFolder
Dim objContacts As Object
Dim objContact As Object
Dim iRow As Integer
Dim sName As String
On Error GoTo Err_Handler
Set olapp = CreateObject("Outlook.Application")
Set nspNameSpace = olapp.GetNamespace("MAPI")
Set fldContacts = nspNameSpace.GetDefaultFolder(olFolderContacts)
Set objContacts = fldContacts.Items
iRow = 1
For Each objContact In objContacts
sName = objContact.FileAs
Cells(iRow, 1).Value = sName
Next objContact
...