WORD Environment Variables 
Author Message
 WORD Environment Variables

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 -

MSWORD
Top of page (current)
Top of document (line 1, page 1)
Next Page
Current line reference
Current table line
Last table line
Number of lines in a table object
Last Page
Bottom of Document (last line, last page)

Thank You

PW



Wed, 15 Oct 2003 05:50:22 GMT  
 WORD Environment Variables
 ... I have a long way to go.


Wed, 15 Oct 2003 05:58:06 GMT  
 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



Wed, 15 Oct 2003 08:22:10 GMT  
 WORD Environment Variables

Nah, it only seems that way.  Keep at it -- especially when it seems
hopeless ;)  -- and it'll fall into place soon, and THEN watch your
brain race.  The fact that you were looking for specific "environment
variables" (code expressions) is good in one sense, but don't hang
onto the notion that you can translate ordinary English (or other
programming languages' structure) into VBA; it's quite different,
and your attempts will be slowed if you don't try to grasp the VBA
object model.

One other hint: These newsgroups get busy, so if you're going to add
a comment about a thread (like this one), it's best to add it to the
*same* thread, not start a new one.  Otherwise not everyone will be
able to tell what you're replying to.


------------- "Life is nothing if you aren't obsessed." --John Waters
---------------------------------------------------------------------

Quote:

>  ... I have a long way to go.



Wed, 15 Oct 2003 09:46:20 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Help : Breaking One WORD variable to two BYTE variable in VB

2. Replacing words/variables in a word document

3. Word 8.0 and VB 5.0: object variable destroyed after closing word

4. Environment variable...

5. Write Environment Variables

6. Environment Variables

7. Environment Variables

8. querying environment variables from vba

9. Using Environment Variable in Template path

10. environment variables

11. Extracting environment variables

12. how to set an environment variable?

 

 
Powered by phpBB® Forum Software