Hi
I'm trying to use this code that I found online:
Dim myOutlook As Outlook.Application
Dim myInformation As Namespace
Dim myContacts As Items
Dim myItems As ContactItem
Set myOutlook = CreateObject("Outlook.Application")
Set myInformation = myOutlook.GetNamespace("MAPI")
Set myContacts = myInformation.GetDefaultFolder(olFolderContacts).Items
For Each myItems In myContacts
If myItems.Email1Address = "j@yoursite.com" Then 'I'm substituting my own address here
myItems.Delete
End If
Next
It keeps getting stuck at the For line (error: Type mismatch). It's got to be something simple, but I simply can't see what the problem is, can anyone enlighten me?
PS: I'm not a programmer, just a keen amateur
I'm trying to use this code that I found online:
Dim myOutlook As Outlook.Application
Dim myInformation As Namespace
Dim myContacts As Items
Dim myItems As ContactItem
Set myOutlook = CreateObject("Outlook.Application")
Set myInformation = myOutlook.GetNamespace("MAPI")
Set myContacts = myInformation.GetDefaultFolder(olFolderContacts).Items
For Each myItems In myContacts
If myItems.Email1Address = "j@yoursite.com" Then 'I'm substituting my own address here
myItems.Delete
End If
Next
It keeps getting stuck at the For line (error: Type mismatch). It's got to be something simple, but I simply can't see what the problem is, can anyone enlighten me?
PS: I'm not a programmer, just a keen amateur