                     MACROS FOR MICROSOFT WORD 4.0
                             April 23, 1988
                                    
                 ************ INTRODUCTION ***********

This is a brief guide on how to use macros in MicroSoft Word version
4.0.  This information was summarized from the Word manual.

Macros are a series of keystrokes and commands that can be invoked at
any time to speed up a complex or repetitive task.  A macro can be very
simple or can be a complex program with branching and logic by using
some of Word's power macro instructions.

You should also be aware that Word version 4.0 includes a glossary file
"macro.gly" which contains a great many macros.  This macro glossary is
loaded by the " Transfer Glossary Merge " command.  Many of these
prebuilt macros may solve some of your needs as is or can easily be
modified.  You may also want to examine some of these macros as a
learning exercise.

Macros are saved in glossaries.  Ones you frequently use should be saved
in your "normal.gly" file.  Ones you seldom use or which may be very big
can be saved in a different glossary file.

              *************** USING MACROS ***************

1.  TO RUN MACRO

Type macro name and press F3, or choose Insert and select from list.

Or, type control code( ie, ctrl l and then m).

2.  TO RECORD A MACRO

Press Shift F3 to start recording.  Enter keystrokes.  Then press Shift
F3 to stop recording.  Next give the Macro a unique name and optionally
a control code which consists of two letters.
 Example : name.mac^<ctrl l>m     (note: the ^ is the shifted 6 key not
the ctrl key).  Pressing the crtl l and then m keys will start macro.

3. TO EDIT EXISTING MACRO (OR WRITE NEW ONE)

Type macro name immediately followed by a ^  ( Note ^ is shifted 6 key).
Then press F3.  Or Choose Insert, select macro, type ^ and press enter.

Edit and revise the macro.  Select or highlight macro.  To save, select
copy, type name of macro and control code if desired.

4.  TESTING MACROS IN STEP MODE

Press ctrl F3 to start step mode.
Run macro as normal(see step 1), except that you must hit a key before
it proceeds to the next step.
Press ctrl F3 to stop step mode.

5.  MISC INFO ON WRITING MACROS

To indicate repeated key strokes, insert a number after key name.  For
example <tab 2> is two tabs.

If you are searching in a macro, and the search is for a special
character such as the end of paragraph (^p), you must include an extra ^
(ie, ^^p).

To switch from typing mode to command mode or vice versa, the macro
should start with <esc>.  To force the macro into the command mode
regardless of the present mode, start the macro with <ctrl esc>.

Chevrons ( ®  ¯ ) are used in macros to delimit.  Enter them by pressing
ctrl + [ or ctrl + ].  All three keys must be pressed at same time.

Autoexec macros start when WORD is first loaded.  Autoexec macros are
simply named 'autoexec'.  Do not use any extension on name.  Name can
have control code.

Nesting of macros can be done by using insert command.  Example:
<esc>iname.mac<enter>.  Could also use name.mac<F3> or its control code
such as <ctrl r>.

6.  MACRO INSTRUCTIONS

ASK

     ®ASK variable=?¯ or  ®ASK variable=?prompt¯

     Will prompt you for input and can ask questions.  Variable can be
     any combination of letter or numbers, but cannot start with a
     number(mike1 is ok, but 1mike is not).  Underscores, hyphens, &
     periods not allowed in variable name.

COMMENT

     ®COMMENT text ¯
     
     Used to enter comments to document macro.  Will not be displayed
     when macro runs.

IF... ELSE...ENDIF

     ®IF condition¯ result ®ENDIF¯
     or ®IF condition¯ result1 ®ELSE¯result2®ENDIF¯

     Example:  ®ask pword=?Enter password¯
               ®if pword = "secret"¯
               ®message permission granted¯
               ®else¯®message permission denied!¯®endif¯
     
     Special variables:
     
     Selection - refers to contents of current text selection
     Scrap     - refers to contents of scrap
     Field     - Refers to value of currently active menu field
     Found,Notfound  - Boolean variables used to test result of search.
     
Operators:

=   Equals             <> not equal to          < less than
>   Greater than       <= less than equal to   >= greater than equal to

     Note: text comparisions not case sensitive.

MESSAGE

     ®MESSAGE text¯
     
     Used to display text on the message line.

PAUSE

     ®PAUSE text¯
     
     Temporarily stops macro to let you select text, etc.  Press enter
     to continue execution of macro.
     
QUIT

     ®QUIT¯   immediately ends macro

REPEAT... ENDREPEAT

     ®repeat n¯ ... instructions ... ®endrepeat¯
     
     All instructions between repeat and endrepeat are done n times.  n
     can be a integer number or a variable representing a integer.

SET

®SET variable = arithmetic expression¯
®SET variable = ?prompt¯

     First form used to modify variable: ®set x = cost * units¯
     Second form used to get user input (similar to ask).

WHILE...ENDWHILE

     ®WHILE condition¯  ... instructions ... ®ENDWHILE¯
     
     Executes instructions while condition is true.  Conditions similar
     to those for IF command.

7.  KEYNAMES

These keynames will simulate actual keystrokes in a macro.

<alt>        <ctrl>          <shift>         <esc>         <enter>
<tab>        <del>           <ins>           <home>        <end>
<left>       <right>         <down>          <up>          <pgdn>
<pgup>       <backspace>     <numlock>       <scrolllock>  <capslock>


<keypad*>  * on numeric keypad
<keypad+>  + on numeric keypad
<keypad->  - on numeric keypad
<space>    used for moving among commands in command menu

8.  EXAMPLE MACRO

Word will not let you underline trailing blanks after a word.  This
macro will let you do that.

®comment macro name: underline.mac^<ctrl u>l      ¯
®comment Will underline trailing blank areas of text¯
®comment It does this by inserting a blank(hex ff) in place of a space¯
®comment (hex 20). Underlining cannot end on a space but can on a blank¯
<ctrl esc><esc>®pause position cursor at right end of area to underline
then press enter¯
®if selection = " "¯
®comment if a space, replace it with a blank¯
®comment enter a blank(hex ff) after this comment(use alt 255)¯ÿ
®comment delete a space & move back to blank¯<del><left>
®endif¯
<f6><home>®pause finish selecting area & press enter.¯
®comment next step assumes style sheet is used. If not, use <alt u>  ¯
<alt x>u
<down>



                     ** the end **

