This documentation is archived and is not being maintained.

CustomXMLPart.Load Method

Office 2007
Allows the template author to populate a CustomXMLPart from an existing file. Returns True if the load was successful.
Aa433521.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 CustomXMLPart object.


NameRequired/OptionalData TypeDescription
FilePathRequiredStringPoints to the file on the user’s computer or on a network containing the XML to be loaded.

Return Value

The following example adds a custom XML part, populates the custom XML part with XML from a file, and then manipulates the part's nodes.

Visual Basic for Applications
Sub ShowCustomXmlParts()
    On Error GoTo Err

    Dim cxp1 As CustomXMLPart

    With ActiveDocument
        ' Example written for Word.

        ' Add a custom XML part and then load the XML from a file.
        Set cxp1 = .CustomXMLParts.Add
        cxp1.Load "c:\invoice.xml"

        Set cxn = cxp1.SelectSingleNode("//*[@quantity < 4]") 
        ' Insert a subtree before the single node selected previously.
        ' Delete custom XML part.
    End With
    Exit Sub
' Exception handling. Show the message and resume.
        MsgBox (Err.Description)
        Resume Next
End Sub