ContactItem 方法 (Outlook)ContactItem.RemovePicture method (Outlook)

从 "联系人" 项目删除图片。Removes a picture from a Contacts item.


expressionexpression. RemovePicture

_表达式_一个代表ContactItem对象的变量。expression A variable that represents a ContactItem object.


以下 Microsoft Visual Basic for Applications (VBA) 示例提示用户指定联系人姓名,并从联系人项目删除图片。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

另请参阅See also

创建 ContactItem 对象ContactItem Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.