Link to home
Start Free TrialLog in
Avatar of escheider
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.
Avatar of toddhd
toddhd

I don't have a lot of experience in this area, but my best guess is that it is unikely you can get that info. I am assuming that the document object represents a word document. The cursor however, is a function of Microsoft Word.

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?
Avatar of escheider

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
Avatar of Sancler
Sancler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Sancler .. this is exactly what I needed to define the location of the cursor, even in Word 2000.