CustomXMLPart.LoadXML method (Office)

Allows the template author to populate a CustomXMLPart object from an XML string. Returns True if the load was successful.

Syntax

expression.LoadXML(XML)

expression An expression that returns a CustomXMLPart object.

Parameters

Name Required/Optional Data type Description
XML Required String Contains the XML to load.

Return value

Boolean

Example

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

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

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.