Vba msxml in vba in Excel

MSXML stands for Microsoft XML Core Services, now legacy, was a set of services that allowed applications written in JScript, VBScript, and Microsoft development tools to build Windows-native XML-based applications (reference wikipedia)

As we saw in the previous chapters, that the XML has a tree like structure, as defined by DOM.

Therefore, to read the contents of the XML document, it has to be traversed in a specific manner, that is, tree path manner.

So, understanding various nodes and its way of access is very important in traversing a XML document.

The various elements in VBA to access the XML nodes is as discussed below.

To use various XML related elements, the following Add-in has to be referenced.

Microsoft.XML, v6.0

This can be done as shown in the screenshot below

excel vba msxml in vba

excel vba msxml in vba

Now, the various elements under this Add-in are discussed below:


This is used to get a XML Node, generally, the root node.


This is used to represent an XML Attribute.


This selects a list of nodes based on the Xpath pattern.


This is used to select a single node; that is, the first matching node from the XML document.


This is used to select a child node based on the pattern.


You can find similar Excel Questions and Answer hereunder

1) How can I filter and copy only filtered data using VBA?

2) Vba code to password protect workbook in Excel

3) How can I dynamically add series to an existing chart using VBA?

4) Excel 2010 vba replacement of application filesearch in Excel

5) How can I copy and rename a WorkSheet using VBA?

6) How can I loop through all ActiveX checkboxes in WorkSheet and set them to Unchecked status?

7) How can I change the Marker size and Marker line color for all the series in a chart?

8) How can I export a WorkSheet as a PDF using VBA?

9) Userform initialize vs userform show in Excel

10) How do I copy a Table from one location to another and retain all formulas, formats and columnwidths?


Here the previous and next chapter