Provide required information needed to triage your issue
The value of Word.Range.end is equal to the position minus 1. For example, the start value of a selection range is greater than the end value of the selection range when the cursor is positioned within the text.
Your Environment
- Platform [PC desktop, Mac, iOS, Office on the web]: Word desktop Mac
- Host [Excel, Word, PowerPoint, etc.]: Word
- Office version number: 16.111 (26062533)
- Operating System: OS 26.5.1
Expected behavior
The value of Word.Range.end corresponds to the position of the end of the range.
Current behavior
Word.Range.end is equal to the position minus 1.
Steps to reproduce
- Run the following script in Script Lab -> https://gist.github.com/pdoyon-Druide/f9a2b2947c45bc4becac6f33c2cc91d8
- Click the « Setup » button.
- Click the « Run » button.
Result
The console indicates that the start position of the selection is greater than the end position, whereas these two positions should be equal.
Link to live example(s)
https://gist.github.com/pdoyon-Druide/f9a2b2947c45bc4becac6f33c2cc91d8)
Context
Useful logs
I observe the same behavior with Word on the Windows desktop.
Provide required information needed to triage your issue
The value of Word.Range.end is equal to the position minus 1. For example, the start value of a selection range is greater than the end value of the selection range when the cursor is positioned within the text.
Your Environment
Expected behavior
The value of Word.Range.end corresponds to the position of the end of the range.
Current behavior
Word.Range.end is equal to the position minus 1.
Steps to reproduce
Result
The console indicates that the start position of the selection is greater than the end position, whereas these two positions should be equal.
Link to live example(s)
https://gist.github.com/pdoyon-Druide/f9a2b2947c45bc4becac6f33c2cc91d8)
Context
Useful logs
I observe the same behavior with Word on the Windows desktop.