Name

xmlmap.Export(Url, [Overwrite])

Synopsis

Exports mapped data in an XML map to an XML file. Returns an xlXmlExportResult constant indicating whether the export was successful.

Argument

Settings

Url

The name of the file to create.

Overwrite

True overwrites the file if Url already exists. False does not overwrite the file and triggers an error if the file already exists. Default is False.

Use the IsExportable property to determine if the data can be exported before using the Export method. Excel exports only nodes that have been mapped to a list or range. Unmapped nodes are not exported, although the file still conforms to the XML map’s schema.

The following code exports mapped nodes in the XML map named Numbers_Map to create the file Numbers.xml:

Set xmap = ThisWorkbook.XmlMaps("Numbers_Map")
If xmap.IsExportable Then
    fname = ThisWorkbook.path & "\Numbers.xml"
   res = xmap.Export(fname, True)
End If

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.