J
John
Hi
I am trying to access outlook contacts folders and delete the contacts that
do not contain a certain category value in the categories field. I have
written the below code but am stuck with the error on the indicated line.
Any help would be appreciated.
Thanks
Regards
Dim O As Outlook.Application
Dim F As Outlook.MAPIFolder
Dim ICount As Long
Dim oContact As Outlook.ContactItem
Dim obj As Outlook.ContactItem
O = New Outlook.Application
F = O.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
For Each obj In F.Items() ' This line gives error: Expression is of type
'Outlook.Items', which is not a collection type.
If TypeOf obj Is Outlook.ContactItem Then
oContact = obj
If InStr(oContact.Categories, "mycat") Then
oContact.Delete()
End If
End If
Next
I am trying to access outlook contacts folders and delete the contacts that
do not contain a certain category value in the categories field. I have
written the below code but am stuck with the error on the indicated line.
Any help would be appreciated.
Thanks
Regards
Dim O As Outlook.Application
Dim F As Outlook.MAPIFolder
Dim ICount As Long
Dim oContact As Outlook.ContactItem
Dim obj As Outlook.ContactItem
O = New Outlook.Application
F = O.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
For Each obj In F.Items() ' This line gives error: Expression is of type
'Outlook.Items', which is not a collection type.
If TypeOf obj Is Outlook.ContactItem Then
oContact = obj
If InStr(oContact.Categories, "mycat") Then
oContact.Delete()
End If
End If
Next