共用方式為


PowerPoint) (CustomerData.Delete 方法

會從 CustomLayoutMaster簡報ShapeSlide 物件的 CustomerData 集合刪除指定的 CustomXMLPart 物件。

語法

運算式刪除 ( _Id_ )

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

參數

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

註解

CustomerData 集合中的個別 CustomXMLPart 物件所代表的 Guid (全域唯一識別碼)。 傳遞表示您想要刪除識別碼為 刪除 方法參數為 字串 的自訂 XML 組件的 GUID。 您可以取得特定的自訂 XML 組件的識別碼逐一查看集合使用的 CustomerData 集合的 Id 屬性。

範例

下列範例會示範如何使用 Delete 方法從 CustomerData 集合刪除自訂 XML 組件。 它會將新的自訂 XML 元件新增至使用中簡報第一張投影片上第一個圖案的 CustomerData 集合。 然後它會取得新的組件識別碼和傳遞給 刪除 方法。

Public Sub Delete_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 
     
    ' Get the current count of custom XML parts 
    Debug.Print pptCustomerData.Count 
     
    ' Add a new CustomXMLPart object to the CustomerData 
    ' collection for this shape and get the revised count of 
    ' custom XML parts 
    Dim pptCustomXMLPart As CustomXMLPart 
    Set pptCustomXMLPart = pptCustomerData.Add 
    Debug.Print pptCustomerData.Count 
     
    ' Get the ID of the new part 
    Dim myString As String 
    myString = pptCustomXMLPart.Id 
    Debug.Print myString 
     
    ' Delete the new part and re-check the count of custom XML parts 
    pptCustomerData.Delete (myString) 
    Debug.Print pptCustomerData.Count 
 
End Sub

另請參閱

CustomerData 集合

支援和意見反應

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