ExportXml Method

Microsoft Excel Visual Basic

Show All Show All

ExportXml 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.

Exports the contents of cells mapped to the specified XmlMap object to a String variable. Returns XlXmlExportResult.

XlXmlExportResult can be one of the following XlXmlExportResult constants:
xlXmlExportSuccess The XML data file was successfully exported.
xlXmlExportValidationFailed The contents of the XML data file do not match the specified schema map.

expression.ExportXml(Data)

expression    Required. An expression that returns one of the objects in the Applies To list.

Data    Required String. The variable to export the data to.

Remarks

To export the contents of the mapped cells to an XML data file, use the Export method.

Example

The following example exports the contents of the cells mapped to the "Contacts" schema map to a variable named strContactData.

    Sub ExportToString()
    Dim strContactData As String

    ActiveWorkbook.XmlMaps("Contacts").ExportXml Data:=strContactData
End Sub