XmlMap.ImportXml (Excel)

Imports XML data from a String variable into cells that have been mapped to the specified XmlMap object. Possible return values are xlXmlImportElementsTruncated - The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet, xlXmlImportSuccess - The XML data file was successfully imported, xlXmlImportValidationFailed - The contents of the XML data file do not match the specified schema map.

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):

ImportXml (XmlData, Overwrite)


Dim strXmlData As String: strXmlData = 
Dim xxiImportXml As XlXmlImportResult
xxiImportXml = ActiveWorkbook.XmlMaps(1).ImportXml(XmlData:=strXmlData)

Arguments

The following argument is required

XmlData (String) - The string that contains the XML data to import.

Optional arguments

The following argument is optional

Overwrite (Boolean) - 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.