Hi,
I am trying to create a VBScript to delete all the contacts under the local conatcts folder.
I currently have:
Sub DeleteContacts()
Dim myOutlook As Outlook.Application
Dim myInformation As NameSpace
Dim myContacts As Items
Dim myItems As ContactItem
Set myOutlook = CreateObject("Outlook.Apllication")
Set myInformation = myOutlook.GetNameSpace("MAPI")
Set myContacts = myInformation.GetDefaultFolder(olFolderContacts).Items
For Each myItems In myContacts
myItems.Delete
Next
End Sub
This however only deleted everyother contact, so only deletes half at a time. Is there something that I have done wrong and need to change? or is there an easier way to do this using VBScript?
Thank you in advance
I am trying to create a VBScript to delete all the contacts under the local conatcts folder.
I currently have:
Sub DeleteContacts()
Dim myOutlook As Outlook.Application
Dim myInformation As NameSpace
Dim myContacts As Items
Dim myItems As ContactItem
Set myOutlook = CreateObject("Outlook.Apllication")
Set myInformation = myOutlook.GetNameSpace("MAPI")
Set myContacts = myInformation.GetDefaultFolder(olFolderContacts).Items
For Each myItems In myContacts
myItems.Delete
Next
End Sub
This however only deleted everyother contact, so only deletes half at a time. Is there something that I have done wrong and need to change? or is there an easier way to do this using VBScript?
Thank you in advance