This documentation is archived and is not being maintained.

CustomXMLParts.SelectByID Method

Office 2007
Selects a custom XML part matching a GUID.
Aa433526.vs_note(en-us,office.12).gif  Note
References to DTDs from custom XML parts are not supported. DTD references in custom XML parts will not resolve, and custom XML parts containing DTD references generate an exception when an attempt is made to save the file's content to a flat XML file.



expression   An expression that returns a CustomXMLParts object.


NameRequired/OptionalData TypeDescription
IdRequiredStringContains the GUID for the custom XML part.

Return Value


If a custom XML part with this ID does not exist, the method returns Nothing.


The following example retrieves a custom XML part matching the GUID and then searches for a node in that part that matches an XPath expression.

Visual Basic for Applications
Dim cxp1 As CustomXMLPart
Dim cxn As CustomXMLNode

' Returns a custom xml part by its ID.
 Set cxp1 = ActiveDocument.CustomXMLParts.SelectByID("F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4")        

' Get the node matching the XPath expression.                             
Set cxn = cxp1.SelectSingleNode("//*[@supplierID = 1]")