Monday, May 22, 2006 9:16 PM
How to set the cursor's position using VSTO in WORD?
Thanks very much!
Tuesday, May 23, 2006 3:09 PMModerator
You don't give us a lot of context to go on...
Basically, you use the Select method of the object you want to select. Often, this will be a range. You can use Range.Find, for example, to search for something, then Range.Select to show that to the user.
Note that you usually only want to move the cursor in order to position it for the user to continue. As a rule, you should manipulate Word's object directly, without moving the cursor.
If you need help with this concept, it would be best to post to the word.programming newsgroup
Describe in more detail what kind of task you need to accomplish in Word. Don't forget to mention which programming language you use, or the code samples you get will be VBA!
Tuesday, May 23, 2006 8:09 PMAnswerer
You can also find some helpful examples of setting the cursor position in the following VSTO help topics:
- How to: Insert Text into Word Documents http://msdn2.microsoft.com/en-us/library/6b9478cs(VS.80).aspx
- How to: Search for Text in Documents http://msdn2.microsoft.com/en-us/library/f1f367bx(VS.80).aspx
- How to: Restore Selections after Searches http://msdn2.microsoft.com/en-us/library/wcht0e98(VS.80).aspx
Hope that helps!