共用方式為


PowerPoint) (CustomerData.Item 方法

會從 CustomerData 集合傳回指定之的 CustomXMLPart 物件。 唯讀。

語法

運算式專案 (標識 符)

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

參數

名稱 必要/選用 資料類型 描述
Id 必要 String CustomXMLPart 物件的識別碼。

傳回值

CustomXMLPart

註解

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.

範例

下列範例會示範如何使用 Item 方法,藉由 ID 字串取得自訂 XML 組件。

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

另請參閱

CustomerData 集合

支援和意見反應

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