troubleshooting Question

Returning the GUID of an unknown CustomXMLPart in PowerPoint's CustomerData object

Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland asked on
XMLMicrosoft PowerPointVBA* Object Oriented Programming
4 Comments1 Solution304 ViewsLast Modified:
I'm experimenting with saving custom XML data to [shape] objects in PowerPoint using the object's CustomerData collection object which stores one or more CustomXML parts. There are three main methods and one property for the CustomerData object:

.Add (method)
.Item (method)
.Delete (method)
.Count (property)

Unlike other collections in the OM, items in the collection are read using a GUID string rather than a numerical index. for example:

Sub TestReadXML()
  Dim GUID As String
  GUID = "{CBAC284D-9000-4CFE-8E8F-FAD5CC8BCAA7}"
  With ActiveWindow.Selection.ShapeRange(1).CustomerData
    With .Item(GUID)
      Debug.Print .XML
    End With
  End With
End Sub

The GUID is created automatically by the .Add method when the CusomXMLPart is initially created so at that point it can be read and saved:

Sub TestWriteXML()
  Dim GUID As String
  With ActiveWindow.Selection.ShapeRange(1).CustomerData
    With .Add
      GUID = .Id
      .LoadXML "<testXML/>"
    End With
  End With
End Sub

Now, given the fact that the GUID cannot be present in more than one CustomXMLPart, either for the same object or multiple objects, when an object that contains a CustomXMLPart is copied, the original maintains its GUID but the copy is assigned a new one automatically.

Let's say I have a shape selected in the example above and I add the XML part, then copy/paste the shape, the new shape has been assigned the same XML data but with a different GUID.

How can I find out what that new GUID is?!

Is it deliberately inaccessible for security reasons or is this just an incomplete part of the PowerPoint OM?
ASKER CERTIFIED SOLUTION
aikimark
Get vaccinated; Social distance; Wear a mask
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros