Partager via


CustomerData.Item Method (PowerPoint)

Returns the specified CustomXMLPart object from the CustomerData collection. Read-only.

Syntax

expression .Item(Id)

expression An expression that returns a CustomerData object.

Parameters

Name

Required/Optional

Data Type

Description

Id

Required

String

The ID of the CustomXMLPart object.

Return Value

CustomXMLPart

Remarks

Individual CustomXMLPart objects in the CustomerData collection are represented by GUIDs (globally unique identifiers). Pass the GUID that represents the custom XML part that you want to get to the Id parameter of the Item method as a String. You can get the ID of a particular custom XML part by getting the value of the Id property of the CustomXMLPart object.

Example

The following example shows how to use the Item method to get a custom XML part by its ID string.

Public Sub Item_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

    

    ' Add a new CustomXMLPart object to the

    ' CustomerData collection for this shape

    Dim pptCustomXMLPart As CustomXMLPart

    Set pptCustomXMLPart = pptCustomerData.Add

           

    ' Get the ID of the new part

    Dim myString As String

    myString = pptCustomXMLPart.Id

    Debug.Print myString

    

    ' Get the new part from the collection by its Id

    ' and load XML into the part

    pptCustomerData.Item(myString).LoadXML ("<text>This is XML data.</text>")

    Debug.Print pptCustomXMLPart.xml



End Sub     

See Also

Concepts

CustomerData Collection

CustomerData Object Members