XmlMap.ImportXml method (Excel)

Imports XML data from a String variable into cells that have been mapped to the specified XmlMap object.

Syntax

expression.ImportXml (XmlData, Overwrite)

expression A variable that represents an XmlMap object.

Parameters

Name Required/Optional Data type Description
XmlData Required String The string that contains the XML data to import.
Overwrite Optional Variant Specifies whether to overwrite the contents of cells that are currently mapped to the specified XML map. Set to True to overwrite the cells; set to False to append the data to the existing range.

If this parameter is not specified, the current value of the AppendOnImport property of the XML map determines whether the contents of cells are overwritten.

Return value

XlXmlImportResult

Remarks

To import the contents of an XML data file into cells mapped to a specific schema map, use the Import method of the XmlMap object.

If either of the following conditions is True, a run-time error occurs. If more than one condition is True, Excel returns a run-time error for the most severe (they are listed with the most severe listed first):

  • If the XML data contains syntactical errors.
  • If the import is cancelled because not all the data could fit on the worksheet.

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.