CustomerData 方法 (PowerPoint)CustomerData.Add method (PowerPoint)

CustomXMLPart 添加到 CustomLayout主控形状演示文稿形状幻灯片 对象 客户 集合和返回创建的 CustomXMLPart 对象。Adds a CustomXMLPart to the CustomerData collection of a CustomLayout, Master, Presentation, Shape, or Slide object and returns the CustomXMLPart object created.

语法Syntax

表达式expression.Add

_表达式_一个返回CustomerData对象的表达式。expression An expression that returns a CustomerData object.

返回值Return value

CustomXMLPartCustomXMLPart

说明Remarks

您可以将客户数据(自定义 XML 部件)的一个或多个数据项添加到上面列出的任意对象,这些对象可包含客户数据。You can add one or more items of customer data (custom XML parts) to any of the objects listed above that can contain customer data.

示例Example

Public Sub Add_Example() 
 
    Dim pptSlide As Slide 
    Set pptSlide = ActivePresentation.Slides(1) 
     
    Dim pptShape As Shape 
    For Each pptShape In pptSlide.Shapes 
         
        ' Get the CustomerData collection of the shape 
        Dim pptCustomerData As customerData 
        Set pptCustomerData = pptShape.customerData 
         
        ' Add a new CustomXMLPart object to the CustomerData collection for this shape 
        Dim pptCustomXMLPart As CustomXMLPart 
        Set pptCustomXMLPart = pptCustomerData.Add 
         
        ' Add data to the CustomXMLPart 
        pptCustomXMLPart.LoadXML ("<ShapeData><DataItem>This has to be valid XML</DataItem></ShapeData>") 
         
        ' Print the ID (a GUID) of the CustomXMLPart 
        Debug.Print (pptCustomXMLPart.Id) 
         
    Next 
 
End Sub

另请参阅See also

客户集合CustomerData Collection

支持和反馈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.