ContactItem.RemovePicture Method (Outlook)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Removes a picture from a Contacts item.

expression .RemovePicture

expression A variable that represents a ContactItem object.

The following Microsoft Visual Basic for Applications (VBA) example prompts the user to specify a name of a contact and removes the picture from the contact item. If a picture does not exist for the contact, the example displays a message to the user.

Sub RemovePictureFromContact() 
 Dim myNms As Outlook.NameSpace 
 Dim myFolder As Outlook.Folder 
 Dim myContactItem As Outlook.ContactItem 
 Dim strName As String 
 Dim strPath As String 
 Dim strPrompt As String 
 Set myNms = Application.GetNamespace("MAPI") 
 Set myFolder = myNms.GetDefaultFolder(olFolderContacts) 
 strName = InputBox("Type the name of the contact: ") 
 Set myContactItem = myFolder.Items(strName) 
 If myContactItem.HasPicture = False Then 
 MsgBox "The contact does not have a picture associated with it." 
 End If 
End Sub