共用方式為


PowerPoint () 的 CustomerData.Add 方法

CustomXMLPart 新增到 CustomLayoutMaster簡報ShapeSlide 物件的 CustomerData 集合,並傳回建立的 CustomXMLPart 物件。

語法

運算式添加

表達 會傳回 CustomerData 物件的運算式。

傳回值

CustomXMLPart

註解

您可以將客戶資料 (自訂 XML 組件) 的一個或多個項目,新增到列於上方且可包含客戶資料的任何物件中。

範例

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

另請參閱

CustomerData 集合

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應