O'Reilly logo

Programming Excel with VBA and .NET by Steve Saunders, Jeff Webb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Program with XML Maps

The preceding sections explained how to use the new XML features found in Excel and provided code for saving, transforming, importing, and exporting XML with Excel. Those sections provide a context for Excel’s XML features and explain programming tasks that surround those features. The rest of this chapter deals exclusively with the XML objects Excel provides and offers specific examples of programming tasks you can perform with those object, properties, and methods.

Excel’s XML object model deals exclusively with XML maps. Opening and saving XML spreadsheets is done through the Workbook object’s Open and Save methods. Figure 15-18 illustrates the Excel XML objects hierarchically.

The XML object hierarchy

Figure 15-18. The XML object hierarchy

The XmlMap object allows you to perform the following tasks in code:

  • Add XML maps to a workbook

  • Delete XML maps from a workbook

  • Export XML data through an XML map

  • Import XML data through an XML map

  • Bind an XML map to an XML data source

  • Refresh mapped lists and ranges from an XML data source

  • View the XML schema used by an XML map

The following sections explain these tasks in greater detail.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required