
WORD Environment Variables
Hi PW,
Quote:
> Howdy,
> I'm trying to get more efficient at the use of macros in WORD & EXCEL
(from
> Office 97 package).
> You will know this means using VBasic.
> I need to do some do/while scripts in both and cannot find the naming of
> particular environment variables.
> e.g. in WORD, DO while NOT END OF DOCUMENT etc
> Can someone plase tell me where I can find a list of all the environment
> variables, especially pertaining to the following -
OK, all the following assume that you want the position of each titem
relative to the current position of the cursor (or Selection object)
Quote:
> MSWORD
> Top of page (current)
ActiveDocument.Bookmarks("\Page").Range.Start
Quote:
> Top of document (line 1, page 1)
ActiveDocument.Range.Start
Quote:
> Next Page
ActiveDocument.Bookmarks("\Page").Range.End
Quote:
> Current line reference
Word doesn't think in lines very easily. if you mean the current line
number, don't think that can be found
Quote:
> Current table line
Selection.Information(wdEndOfRangeRowNumber)
Quote:
> Last table line
Selection.Tables(1).Range.End
Quote:
> Number of lines in a table object
Selection.Tables(1).Rows.Count
Quote:
> Last Page
You mean the position of the start of the last page? You can't get the
position directly, but you can move there with these commands
Selection.Move Unit:=wdStory, Count:=1
Selection.Goto What:=wdGotoPage, Which:=wdGotoPrevious
Quote:
> Bottom of Document (last line, last page)
ActiveDocument.Range.End
--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email