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

从**CustomerData** 集合中返回指定的**CustomXMLPart** 对象。Returns the specified CustomXMLPart object from the CustomerData collection. 此为只读属性。Read-only.

语法Syntax

表达式(Id)expression.Item (Id)

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

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
IdId 必需Required StringString CustomXMLPart对象的 ID。The ID of the CustomXMLPart object.

返回值Return value

CustomXMLPartCustomXMLPart

说明Remarks

CustomerData集合中的单个CustomXMLPart对象由 guid (全局唯一标识符) 表示。Individual CustomXMLPart objects in the CustomerData collection are represented by GUIDs (globally unique identifiers). 通过 GUID,它表示要获取 Item 方法作为 字符串 的 Id 参数的自定义 XML 部件。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. 通过获取 CustomXMLPart 对象的 Id 属性的值,可以获取特定的自定义 XML 部件的 ID。You can get the ID of a particular custom XML part by getting the value of the Id property of the CustomXMLPart object.

示例Example

以下示例演示如何使用 Item 方法按自定义 XML 部件的 ID 字符串获取自定义 XML 部件。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

客户集合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.