ImportXml Method

Microsoft Excel Visual Basic

Show All Show All

ImportXml Method

Note  XML features, except for saving files in the XML Spreadsheet format, are available only in Microsoft Office Professional Edition 2003 and Microsoft Office Excel 2003.

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

XlXmlImportResult can be one of the following XlXmlImportResult constants:
xlXmlImportElementsTruncated The contents of the specified XML data file have been truncated because some of the XML data is too large for a cell.
xlXmlImportSuccess The XML data file was successfully imported.
xlXmlImportValidationFailed The contents of the XML data file do not match the specified schema map.

expression.ImportXml(XmlData, Overwrite)

expression    Required. An expression that returns an XmlMap object.

XmlData    Required String. The string that contains the XML data to import.

Overwrite    Optional Boolean value. 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 or not.

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.