axism
MIS
- May 17, 2005
- 58
Hi, I need help with deleting all my contacts in my outlook except for the 2 distribution list i made. Is there a way to do it? thank you
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub DeleteContact()
'Ensure reference to the outlook object is made.
Dim olSession As Outlook.Application
Dim olNamespace As NameSpace
Dim olContacts As Outlook.MAPIFolder
Dim olItem As ContactItem
Set olSession = New Outlook.Application
Set olNamespace = olSession.GetNamespace("MAPI")
Set olContacts = olNamespace.GetDefaultFolder(olFolderContacts)
For Each olItem In olContacts.Items
olItem.Delete
Next
Set olSession = Nothing
Set olNamespace = Nothing
Set olContacts = Nothing
End Sub