04 SaveXML - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki
SaveXML method
Saves as a XML file in PersistXML format. Returns True if successful, otherwise False.
Applies to
| TableData | ArrData | RsetData | Xdata | XShared |
|---|---|---|---|---|
| ✓ | ✓ | ✓ |
Parameters
| Name | Type | Description |
|---|---|---|
| FileName | Variant | Name/path of the file/object to be created from this data. |
All Xdata objects can be saved in XML format. The PersistXML format used is that native to ADODB, but is different from the XML format used by Excel XML procedures. FileName can be a file name (including path) or can be a MSXML2.DOMDocument.6.0 object. Do not save more than once to the same destination (if a file and you need to save again, delete the previous file first).
Only the data is saved, but no indexes, formatting, formulas etc.
For TableData, this method uses the range Value(xlRangeValueMSPersistXML) property, which attempts to deduce the data type of each column, but can give incorrect results where a column contains mixed types or blanks. If this is a problem, copy the data to a RsetData object first where you can set the data types.
For ArrData, RsetData must also be present. Multiple ArrData objects can be saved in a single xml file using SaveAllXML.