Range.XPath property (Excel)

Returns an XPath object that represents the XPath of the element mapped to the specified Range object. The context of the range determines whether the action succeeds or returns an empty object. Read-only.

Syntax

expression.XPath

expression A variable that represents a Range object.

Remarks

The XPath property is valid when the range it contains meets the following conditions:

  • The range is a single cell.

  • If the range consists of two or more cells, one or the other must be true:

    • If the cells contain XPath information, all cells in the range must contain XPath information (that is, each cell is associated with one or more data maps), and all of the cells must have identical XPath content (that is, each cell contributes to the same set of data maps).

    • All of the cells must contain no XPath information.

  • The range does not contain discontinuous areas.

Note

The header and totals row of a table are considered to contain XPath information. Any ranges that don't meet the above conditions returns a run-time error.

If the range selection is valid, but none of the cells are mapped, Excel returns an XPath object so that you can access the SetValue method to create a mapping.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.