escheider
asked on
Defining a range in a Word Document
Hello Experts:
I have successfully create an object to open an existing word document, setup a command bar and created buttons on the command bar that interact with the document; However, I am having one problem. I need to determine the current location of the cursor so that I can create a range to insert some information.
I have an object called Worddoc that represents the currently opened document. I also have an variable that is used to reference a range within that document .. wrdRange.
I'll be glad to award 1000 points to the individual that helps me solve this issue.
Thanks ...
I'm currently coding this for Word 2000.
I have successfully create an object to open an existing word document, setup a command bar and created buttons on the command bar that interact with the document; However, I am having one problem. I need to determine the current location of the cursor so that I can create a range to insert some information.
I have an object called Worddoc that represents the currently opened document. I also have an variable that is used to reference a range within that document .. wrdRange.
I'll be glad to award 1000 points to the individual that helps me solve this issue.
Thanks ...
I'm currently coding this for Word 2000.
ASKER
Even if I inserted the custom tag, I'd like to do it by clicking the button on the commandbar that I have created; Therefore, I would still need to know the location of the cursor to do this. I am using this application to build templates and the commandbar is used to complete this process.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Sancler .. this is exactly what I needed to define the location of the cursor, even in Word 2000.
In other words, MS Word is the editor, and it maintaines the location of the cursor. That cursor location isn't "saved" when you save the document. Close the document and open it again, the cursor goes back to the beginning.
So if your document object represents a word doc, then I don't see how it could determine where the cursor is in the editor.
Of course, I could be completely wrong... :)
Perhaps you could implement some sort of method such as having the user insert a custom tag in the Word doc, and then searching the doc to locate that tag, and go from there?