Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
After you define a Range object in a Microsoft Office Word document, you change its start and end points by using the MoveStart and MoveEnd methods. The MoveStart and MoveEnd methods take the same two arguments, Unit and Count. The Count argument is the number of units to move, and the Unit argument can be one of the following WdUnits values:
Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word. For more information, see Features available by Office application and project type.
The following example defines a seven-character range. It then moves the start position of the range seven characters after the original start position. Because the end position of the range was also seven characters after the start position, the result is a range that consists of zero characters. The code then moves the end position seven characters after the current end position.
Define a range of characters. For more information, see How to: Programmatically define and select ranges in documents.
The following code example can be used in a document-level customization.
The following code example can be used in a VSTO Add-in. This example uses the active document.
Use the MoveStart method of the Range object to move the start position of the range.
Use the MoveEnd method of the Range object to move the end position of the range.
The following example shows the complete code for a document-level customization. To use this code, run it from the ThisDocument
class in your project.
The following example shows the complete code for a VSTO Add-in. To use this code, run it from the ThisAddIn
class in your project.
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!