Your article is most useful.
I have a problem. When I insert texts in a word document (word automation), how I can retrieve information on current line? Which number line I have reached?
Might be usef retrieve information from status bar. You know how do it?
the MSDN Office Development is a huge document,exactly where would I look on this site?
On the main page of MSDN Office Development, on the right there is a menu: Products and Technologies. There you'll select the product you with to script for (Word, Excel, Access...). This will lead you to the product's home page - for example, to the Word Developer Portal. Again, on the right is the menu with a Wrod product line - select one that fits (Word 2007 for instance).
On that final page, look at the References section. That's where you should look.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
Nice article, I just wanted to point out 2 things.
1. Error handling - it is sometimes a good idea to add this into the code as Word could behave erratic across different system setups or between different versions of Word. When Word throws an unanticipated error, you could be left with a Word object that hasn't been disposed, etc.
Using a try/catch block on a possibly finicky line of code is the best safety precaution:
//normal code here
//error handling & cleanup routines here
2. Additional navigation methods - you can also use (1) the Find feature of Word within the Selection object to navigate the document, as well as (2) the hyperlink follow feature:
//cursor now at start of found text, do something
//no change in cursor position
WScript.Echo("Failed to find the text in the document.");
//or after finding a document hyperlink in word
//this will bring you to the beginning of the hyperlinked source
Last Visit: 31-Dec-99 19:00 Last Update: 6-May-15 12:24