Skip to main content

Range.XPath property

Table of contents
  1. Syntax
  2. Remarks

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.



expression A variable that represents a Range object.


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.

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.

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>