ExportXML Method

Microsoft Office Web Components Object Model

Show All

ExportXML Method

       

Saves the current recordset as an XML file.

expression.ExportXML(XMLDataTransformFile, eEncoding)

expression   Required. An expression that returns a DataSourceControl object.

XMLDataTransformFile  Optional Variant. A path to an XSLT file.

eEncoding  Optional DscEncodingEnum. The format in which schema information is exported. If this argument is omitted, schema information is embedded in the data document.

DscEncodingEnum can be one of these DscEncodingEnum constants.
dscEUCJ
dscUCS2
dscUCS4
dscUTF16
dscUTF8 default
dscWindows

Remarks

Use the XMLLocation property to set whether the data is exported to an XML data island or a separate XML data file. Use the XMLDataTarget property to specify the path or ID to use when exporting the data.

Example

This example exports the current data in the data source control named MSODSC to an XML data file.

Sub ExportData()

   Dim dscConstants

   Set dscConstants = MSODSC.Constants

   ' Set the location of the XML data to a data file.
   MSODSC.XMLLocation = dscConstants.dscXMLDataFile

   ' Set the specific target to export to.
   MSODSC.XMLDataTarget = "Q1 Sales Analysis.xml"

   ' Export the current data.
   MSODSC.ExportXML

End Sub