CustomerData.Delete 方法 (PowerPoint)
从 客户 的 CustomLayout 、 主控形状 、 演示文稿 、 形状 或 幻灯片 对象集合中删除指定的 CustomXMLPart 对象。
语法
表达式。删除 ( _Id_
)
表达 返回 CustomerData 对象的表达式。
参数
名称 | 必需/可选 | 数据类型 | 说明 |
---|---|---|---|
Id | 必需 | String | 要删除 CustomXMLPart 对象的 ID。 |
备注
客户 集合中的单个 CustomXMLPart 对象表示通过 Guid (全局唯一标识符)。 通过表示要到 Id 参数的 字符串 形式的 Delete 方法删除的自定义 XML 部件的 GUID。 可以通过循环访问该集合,获得特定的自定义 XML 部件的 ID,使用 Id 属性的 客户 集合。
示例
下面的示例演示如何使用 Delete 方法从 客户 集合中删除一个自定义 XML 部件。 它将新的自定义 XML 部件添加到活动演示文稿第一张幻灯片上第一个形状的 CustomerData 集合。 然后它获取新部件的 ID 并将其传递给的 Delete 方法。
Public Sub Delete_Example()
Dim pptSlide As Slide
Set pptSlide = ActivePresentation.Slides(1)
Dim pptShape As Shape
Set pptShape = pptSlide.Shapes(1)
' Get the CustomerData collection of the shape
Dim pptCustomerData As customerData
Set pptCustomerData = pptShape.customerData
' Get the current count of custom XML parts
Debug.Print pptCustomerData.Count
' Add a new CustomXMLPart object to the CustomerData
' collection for this shape and get the revised count of
' custom XML parts
Dim pptCustomXMLPart As CustomXMLPart
Set pptCustomXMLPart = pptCustomerData.Add
Debug.Print pptCustomerData.Count
' Get the ID of the new part
Dim myString As String
myString = pptCustomXMLPart.Id
Debug.Print myString
' Delete the new part and re-check the count of custom XML parts
pptCustomerData.Delete (myString)
Debug.Print pptCustomerData.Count
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈