ContactItem.RemovePicture method (Outlook)

Removes a picture from a Contacts item.

Syntax

expression. RemovePicture

expression A variable that represents a ContactItem object.

Example

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." 
 
 Else 
 
 myContactItem.RemovePicture 
 
 myContactItem.Save 
 
 myContactItem.Display 
 
 End If 
 
End Sub

See also

ContactItem Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.