Compartir a través de


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

Concepts

CustomXMLPart Object Members

CustomXMLPart Object