Skip to content

Word.Range.end is equal to the position minus 1. #6793

Description

@pdoyon-Druide

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

  1. Run the following script in Script Lab -> https://gist.github.com/pdoyon-Druide/f9a2b2947c45bc4becac6f33c2cc91d8
  2. Click the « Setup » button.
  3. 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.

Metadata

Metadata

Labels

Area: WordIssue related to Word add-insNeeds: attention 👋Waiting on Microsoft to provide feedback

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions