This documentation is archived and is not being maintained.

CustomXMLPart.LoadXML Method

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

Syntax

expression.LoadXML(XML)

expression   An expression that returns a CustomXMLPart object.

Parameters

NameRequired/OptionalData TypeDescription
XMLRequiredStringContains the XML to load.

Return Value
Boolean

Example
The following example loads XML into a custom XML part from a string.

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

    Dim cxp1 As CustomXMLPart

        ' Add a custom XML part and then load the XML.
        Set cxp1 = ActiveDocument.CustomXMLParts.Add
        cxp1.LoadXML("<discounts><discount>0.10</discount></discounts>")
    
    Exit Sub
                
' Exception handling. Show the message and resume.
Err:
        MsgBox (Err.Description)
        Resume Next
End Sub



Show: