CustomerData.Add method (PowerPoint)

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

expression An expression that returns a CustomerData object.

Return value

CustomXMLPart

Remarks

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

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.