Worksheet.XmlMapQuery (Excel)

Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet.

Unlike the XmlDataQuery method, the XmlMapQuery method returns the entire column of an XML list, including the header row.

XmlMapQuery (XPath, SelectionNamespaces, Map)


Dim strXPath As String: strXPath = 
Dim rngXmlMapQuery As Range
Set rngXmlMapQuery = ActiveSheet.XmlMapQuery(XPath:=strXPath)

Arguments

The following argument is required

XPath (String) - The XPath to query for.

Optional arguments

The following arguments are optional

SelectionNamespaces (String) - A space-delimited String that contains the namespaces referenced in the XPath parameter. A run-time error is generated if one of the specified namespaces cannot be resolved.

Map - Specify an XML map if you want to query for the XPath within a specific map