|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Reset Ranges in Word Documents
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
Microsoft Office version
For more information, see Features Available by Application and Project Type.
Use the SetRange(Int32, Int32) method to resize an existing range in a Microsoft Office Word document.
To reset an existing range
Set an initial range starting with the first seven characters in the document.
The following code example can be used in a document-level customization.
The following code example can be used in an application-level add-in. This code uses the active document.
Use SetRange(Int32, Int32) to start the range at the second sentence and end it at the end of the fifth sentence.
To reset an existing range in a document-level customization
The following example shows the complete example for a document-level customization. To use this code, run it from the ThisDocument class in your project.
To reset an existing range in an application-level add-in
The following example shows the complete example for an application-level add-in. To use this code, run it from the ThisAddIn class in your project.