Programmatically Changing XML Map Properties

Once an XML map exists, there may be cause to change a few of its properties programmatically. In the following code snippet, you pass the name of your map the XMLMaps collection, and then adjust each available property. These properties coincide with those discussed in the section called "Consuming XML Data Directly":

Sub ChangeXmlMapProperties()

With ActiveWorkbook.XmlMaps("EmployeeSales_Map")

'Change map name

'XML schema definition validation

.ShowImportExportValidationErrors = False

'Data source property

.SaveDataSourceDefinition = True

'Data formatting and layout properties .AdjustColumnWidth = True .PreserveColumnFilter = True .PreserveNumberFormatting = True

'Overwrite or Append data 'False Overwrites while True Appends .AppendOnlmport = False

End With

'This example references the XML map by index number

ThisWorkbook.XmlMaps(1).Name = "EmployeeSales_Map"

End Sub

0 0


Post a comment