Activates the window whose title bar is specified by WindowText$. If PaneNum is supplied, a value of 1 or 2 activates the top pane and a value of 3 or 4 activates the bottom pane. (HACKER'S GUIDE ALERT:>WindowText$ ltd to 255 characters)
:AppActivate
Syntax: AppActivate WindowText$, [Immediate]
Activates the application whose title bar is specified by WindowText$. If Immediate is 1, Word immediately switches the focus to the other application. If Immediate is 0 (zero), and Word does not have the focus,Word flashes its title bar, waits for the user to give the focus to Word, and then activates the application.
:AppInfo$()
Syntax: A$ = AppInfo$(TypeOfInfo)
Returns information about the state of Word.
Info Result
----- ------------
1 The environment string; for example, "Windows 2.1.1"
2 The version number of Word; for example, "1.00"
3 Word is in a special mode; for example, CopyText or MoveText mode
4 X position of the Word window, measured from the left of the screen in points
5 Y position of the Word window, measured from the top of the screen in points
6 Width of the current document window in points
7 Height of the current document window in points
8 Returns -1 if the application is maximized
9 Amount of total conventional memory
10 Amount of total conventional memory available
11 Amount of total expanded memory
12 Amount of total expanded memory available
13 Returns -1 if a math coprocessor is installed
14 Returns -1 if a mouse is present
15 Amount of disk space available
Values are returned as strings. Use Val(AppInfo$(n)) to convert the string to a number, if appropriate.
:AppMaximize
Syntax: AppMaximize
Zooms the Word window to full screen size.
:AppMaximize()
Syntax: Log = AppMaximize()
Returns a nonzero value if the window is maximized.
:AppMinimize
Syntax: AppMinimize
Minimizes the Word window to an icon.
:AppMinimize()
Syntax: Log = AppMinimize()
Returns a nonzero value if the window is minimized.
:AppMove
Syntax: AppMove XPos, YPos
Moves the Word window to XPos, YPos relative to the top left of the screen. Values are in points.
AppMove 20, 40
Moves the Word window to a position at 20 points right and 40 points down from top-left corner of the screen
:AppRestore
Syntax: AppRestore
Restores the Word window from a maximized/minimized state.
:AppSize
Syntax: AppSize XPos, YPos
Resizes the Word window. Values are in points.
:Asc()
Syntax: Num = Asc(A$)
Returns the ANSI character code of the first character in A$.
Function Return value
Print Asc("Sign") 83
:Beep
Syntax: Beep [Beeptype]
Causes the computer's speaker to beep. Beeptype is 1, 2, 3, or 4. If Beeptype is omitted, it is assumed to be 1. The exact tone produced will depend on your hardware configuration. A typical use of Beep is to signal the end of a macro.
:Begin Dialog
Syntax: Begin Dialog UserDialog [x], [y], dx, dy
Starts the dialog box declaration. The dx and dy arguments are the width and height of the dialog box (relative to the given x and y coordinates). If x and y are not supplied, then the dialog box is positioned automatically by Word at the point where dialog boxes usually appear on the screen.
:Bold
Syntax: Bold [On]
Without the argument, toggles bold for the entire selection. If On is nonzero, makes the entire selection bold. If On is 0 (zero), removes bold from the entire selection.
:Bold()
Syntax: Num = Bold()
Returns 0 (zero) if none of the selection is bold, 1 if all of the selection is bold, or -1 if part of the selection is bold.
:BookmarkName$()
Syntax: A$ = BookmarkName$(Count)
Returns the name of the bookmark defined in the given context (global or
document template). Count must be in the range from 1 to CountBookmarks. The name is taken from the list in the given context.
:Call
Syntax: [Call] Subname [ParameterList]
Transfers control to a subroutine.
:Cancel
Syntax: Cancel
Terminates a mode such as ColumnSelect and does not perform the action. See "OK," later in this section.
:CancelButton
See "OKButton"
:Case
See "Select Case"
:CenterPara
Syntax: CenterPara
Centers the currently selected paragraph(s).
:CenterPara()
Syntax: Num = CenterPara()
Returns 0 (zero) if none of the selected paragraphs are centered, 1 if all of the selected paragraphs are centered, or -1 if more than one kind of paragraph alignment is used.
:ChangeCase
Syntax: ChangeCase [Type]
Without an argument, alternates the case of the current selection between all lowercase, all caps, and initial caps based on the first two characters of the selection. If Type is 0 (zero), sets the text to all lowercase. If Type is 1, sets the text to all caps. If Type is 2, sets the text to initial caps. If the selection is an insertion point, Word does not perform an action.
Arg selected text New text is
----- --------------------- ------------------
0 How many? how many?
1 How many? HOW MANY?
2 How many? How Many?
none How many? how many?
:ChangeRulerMode
Syntax: ChangeRulerMode
Cycles the ruler between Paragraph, Table, and Document modes.
:CharColor
Syntax: CharColor Color
Sets the character color of the selection to Color. The color may be one of the following:
(Auto means the color specified byt he Control Panel setting).
Arg Description
0 Auto
1 Black
2 Blue
3 Cyan
4 Green
5 Magenta
6 Red
7 Yellow
8 White
:CharColor()
Syntax: Num = CharColor()
Returns the numbers set by the CharColor statement, or -1 if all the selected text is not the same color. See CharColor.
:CharLeft
Syntax: CharLeft [Repeat], [Select]
Moves the selection left by Repeat characters. If the argument is omitted, 1 is assumed. If Select is nonzero, the selection is extended to the left or right by Repeat characters.
STATEMENT: CharLeft 5, 1
EFFECT: Extends the selection five characters to the left of the insertion point
:CharlLeft ()
Syntax: Log = CharLeft [Repeat], [Select]
Moves the selection left by Repeat characters. Returns 0 (zero) if the action cannot be performed.
:CharRight
Syntax: CharRight [Repeat], [Select]
Moves the selection right by Repeat characters. If the Repeat argument is omitted, 1 is assumed. If Select is nonzero, the selection is extended to the right by Repeat characters. If Select is 0 (zero) or omitted, the selection is not extended.
STATEMENT: CharRight 10
EFFECT: Moves the selection point 10 characters to the right of the insertion point, but does not extend the selection
:CharRight ()
Syntax: Log = CharRight [Repeat], [Select]
Moves the selection right by Repeat characters. Returns 0 (zero) if the action cannot be performed.
:ChDir
Syntax: ChDir Name$
Changes directories to the one specified by Name$. (HACKER'S GUIDE ALERT:>Name$ ltd to 255 characters)
:CheckBox
Syntax: CheckBox x, y, dx, dy, Text$, .Field
Creates a check box. When the dialog box is used .Field contains the current setting: if the value is 0, the box is not checked; any other value means the box is checked. The result is a numeric field with the value 0 (zero) (not checked) or -1 (checked) in the dialog record returned from Dialog.
CheckBox 97,54,36,12 "&Bold", .bold
:Chr$()
Syntax: A$ = Chr$(n)
Returns the character whose ANSI code is n.
:Close
Syntax: Close [[#]StreamNumber]
Closes the file attached to StreamNumber. If StreamNumber is not supplied, all open files are closed.
:ClosePane
Syntax: ClosePane
Closes the current window pane. You use this statement to close a pane in a split document, a header/footer pane, a footnote pane, etc. This does not close a document window, only a pane in a window.
:CloseUpPara
Syntax: CloseUpPara
Makes the space before and after the selected paragraph 0 (zero).
:CmpBookmarks()
Syntax: Num = CmpBookmarks(Bookmark1$, Bookmark2$)
Compares two named bookmarks and returns one of the following values:
Return.....Meaning
0 Bookmark1$ and Bookmark2$ are equivalent
1 Bookmark1$ is entirely below Bookmark2$
2 Bookmark1$ is entirely above Bookmark2$
3 Bookmark1$ is below and inside Bookmark2$
4 Bookmark1$ is inside and above Bookmark2$
5 Bookmark1$ encloses Bookmark2$
6 Bookmark2$ encloses Bookmark1$
7 Bookmark1$ and Bookmark2$ begin at the same point, but Bookmark1$ is longer
8 Bookmark1$ and Bookmark2$ begin at the same point, but Bookmark2$ is longer
9 Bookmark1$ and Bookmark2$ end at the same place, but Bookmark1$ is longer
10 Bookmark1$ and Bookmark2$ end at the same place, but Bookmark2$ is longer
11 Bookmark1$ is below and adjacent to Bookmark2$
12 Bookmark1$ is above and adjacent to Bookmark2$
FUNCTION: CmpBookmarks("Intro", "Begin")
EFFECT: If both refer to the same place, returns 0; if Intro is below begin, returns 1; if Intro is above Begin, returns 2.
FUNCTION: CmpBookmarks("Intro", "Conclusion")
EFFECT: Returns 2 if Intro is entirely above Conclusion
FUNCTION: CmpBookmarks("Price", "\Sel")
EFFECT: Returns 0 if the selection is the same as the bookmark Price
:ColumnSelect
Syntax: ColumnSelect
Starts the column selection mode. Cancel ends this mode.
:ComboBox
Syntax: ComboBox x, y, dx, dy, ArrayVariable$(), .Result$ (corrected, per HACKER'S GUIDE)
Creates an expanded combo box with the list box filled from the ArrayVariable$.
When the dialog box is used, .Result$ contains the current setting, your selected
choice, returned from Dialog. (HACKER'S GUIDE ALERT:>Result$ isn't a field, it's just the Result; () on ArrayVariable$ are req'd; multi-dimensioned array as ArrayVariable$() will only show the first dimension (see HG))
ComboBox 6, 31, 49, 33, Air$(), .LB
:ContinueMacro
(HACKER'S GUIDE ALERT: > undocumented)
:ControlRun
Syntax: ControlRun Application
Equivalent to the Run command on the System menu. Runs an application from the Word Control menu.
EFFECT: Changes references to the text covered by the bookmark month_sales to the bookmark sales_receipts
:CopyFormat
Syntax: CopyFormat
Copies the formatting of the selected text.
To use this statement:
1 Make a selection.
2 Run CopyFormat.
3 Select where you want to paste the formatting.
4 Run OK (press Enter).
:CopyText
Syntax: CopyText
Copies text. Equivalent to the copy to key (Shift+F2).
To use this statement:
1 Make a selection.
2 Run CopyText.
3 Select where you want to paste the text.
4 Run OK (press Enter).
:CountBookmarks()
Syntax: Num = CountBookmarks()
Returns the number of bookmarks you have defined in the document.
:CountFiles()
Syntax: Num = CountFiles()
Returns the number of names in the file list on the File menu.
:CountFonts()
Syntax: Num = CountFonts()
Returns the number of fonts available with the printer you've selected.
:CountGlossaries()
Syntax: Num = CountGlossaries([Context])
Returns the number of glossaries defined in the given context. Context can be 0 (zero) for global or 1 for document template. The default is global.
:CountMacros()
Syntax: Num = CountMacros([Context], [All])
Returns the number of programs defined in the given context. Context can be 0 (zero) for global or 1 for document template. The default is global.
If All is nonzero, built in macros are included.
:CountMenuItems
(HACKER'S GUIDE ALERT: > undocumented)
:CountStyles()
Syntax: Num = CountStyles([Context], [All])
Returns the number of styles defined in the given context. Context can be 0 (zero) for the document or 1 for document template. The default is document.
If All is nonzero, built in styles are included.
:CountWindows()
Syntax: Num = CountWindows()
Returns the number of windows in the list on the Window menu.
:Date$()
Syntax: A$ = Date$()
Returns today's date.
:DDEExecute
Syntax: DDEExecute ChanNum, ExecuteString$
Sends an execute message over the channel ChanNum with an ExecuteString$, which is defined by the receiving application. Use the format described under SendKeys to send specific key sequences.
The channel number must have been opened by the DDEInitiate() function.
If the channel is not valid or if the receiving application refuses to execute the
instructions, an error is generated.
:DDEInitiate()
Syntax: ChanNum = DDEInitiate(App$, Topic$)
Opens a DDE channel to an application. App$ is the application name defined by the other application. Topic$ describes something in the application you are accessing, usually the document containing the data you wish to use.
If DDEInitiate() is successful, it returns the number of the open channel. All subsequent DDE macro functions use this number to specify the channel. This function returns 0 (zero) if it fails to open a channel.
FUNCTION: ChanNum = DDEInitiate("Excel", "LOAN.XLS")EFFECT: Initiates a channel to Microsoft Excel and the file LOAN.XLS; the ChanNum variable holds the channel number returned
:DDEPoke
Syntax: DDEPoke ChanNum, Item$, Data$
Sends the data to the item specified by Item$ in the application connected to channel ChanNum. ChanNum must have been opened by the DDEInitiate() function. If DDEPoke is unsuccessful, an error is generated.
:DDERequest$()
Syntax: A$ = DDERequest$(ChanNum, Item$)
Requests the information specified by Item$ over the DDE channel specified by ChanNum. ChanNum must have been opened by the DDEInitiate() function. If DDERequest$() is unsuccessful, a null string ("") is returned.
DDERequest$() returns the data in CF_TEXT format. Pictures or text in Rich Text
Format cannot be transferred.
:DDETerminate
Syntax: DDETerminate ChanNum
Closes the channel ChanNum. The channel must have been opened with the DDEInitiate() function.
:DDETerminateAll
Syntax: DDETerminateAll
Similar to DDETerminate, but closes all open channels.
:Declare
Syntax: Declare Sub SubName Lib LibName [ParameterList] [Alias ModuleName]
Syntax: Declare Function FunctionName Lib LibName [ParameterList] [Alias ModuleName]
Declares an external library function as a subroutine or function inside a macro. For more information on the Declare statement, see Macros: Introduction.
:DeleteBackWord
Syntax: DeleteBackWord
Deletes the word immediately preceding the selection but does not place it on the Clipboard.
:DeleteFile
(HACKER'S GUIDE ALERT: > See Kill)
:DeleteWord
Syntax: DeleteWord
Deletes the word immediately following the selection but does not place it on the Clipboard.
:Dialog
Syntax: Dialog DialogRecord
Displays the dialog box specified by DialogRecord, for editing. After editing, you can store edits in DialogRecord by choosing OK or lose edits by choosing Cancel. Choosing Cancel produces a run-time error that you can trap with On Error.
:Dialog Control Definition Statements
You can create your own dialog boxes and customized menus with Word macros. The control statements used in dialog box construction are described in this section. For more information on dialog box construction, see Macros: Introduction.
In the syntax lines, the following arguments are used:
Arg Meaning
----- --------------
x Horizontal position of the item in 1/4 system font character width units
y Vertical position of the item in 1/8 system font character width units
dx Width of the item in 1/4 system font character width units
dy Height of the item in 1/8 system font character width units
(HACKER'S GUIDE ALERT:>Dialog Boxes are ltd to 512 characters, including variable data; max 32 items, list boxes =2, combo boxes =3...x also seems to be limited to <=510).
:Dim
Syntax: Dim [Shared] Var [(Size)] [, Var [(Size)]...]
Declares a variable's type and allocates storage space for the variable. For more information on the Dim statement, see Macros: Introduction.
:DisableInput
Syntax: DisableInput [Disable]
Prevents the Esc key from interrupting a macro. Input is enabled by setting Disable to 0 (zero).
Statement Effect
----------------- -----------
DisableInput 0 Disable inactive
DisableInput 1 Disable active (default)
:DocClose
Syntax: DocClose [Save]
Closes the current window or pane. If Save is 1, Word saves the document if it has been edited (considered "dirty") since the last save; if Save is 2, Word does not save the document, but closes the window or pane.
:DocMaximize
Syntax: DocMaximize
Zooms the document window to application window size. If it is already maximized, the screen is displayed in the restored state.
:DocMaximize()
Syntax: Log = DocMaximize()
Returns -1 if the window is maximized.
STATEMENT: If Not DocMaximize() Then DocMaximize
EFFECT: Tests the document window to see if it is maximized; if it is, no action is
performed; if the window is not maximized, maximizes the window
:DocMove
Syntax: DocMove XPos, YPos
Moves the document window to XPos, YPos relative to the top-left corner of the document area. Values are in points.
STATEMENT: DocMove 20,40
EFFECT: Moves the window to the position 20 points to the right and 40 points down from the top-left corner of the document area. [HACKER'S GUIDE ALERT: > since there's no echo off in WordBASIC, use Super DocSize 10,10 to make a window a small as possible, then doc Maximize to restore; use DocMove 300,300 to move the window out of sight while macro running, then use DocMove 0,0 to bring it back.]
:DocRestore
Syntax: DocRestore
Restores the Word window from a maximized state.
:DocSize
Syntax: DocSize Width, Height
Sizes the document window to Width, Height. Values are in points.
:DocSplit
Syntax: DocSplit Percentage
Splits the current window at the given percentage height.
:DocSplit()
Syntax: Num = DocSplit()
Returns the current window split position as a percentage of the window height, or 0 (zero) if the window isn't split.
:DoFieldClick
Syntax: DoFieldClick
Simulates a mouse button double-click within the GOTOBUTTON and MACROBUTTON fields' prompt. See Fields for information on these fields.
:DoubleUnderline
Syntax: DoubleUnderline [On]
Without the argument, toggles double underlining for the entire selection. If On is 1, Word makes the entire selection double underlined. If On is 0 (zero), Word removes double underlining from the entire selection.
:DoubleUnderline()
Syntax: Num = DoubleUnderline()
Returns 0 (zero) if none of the selection is double underlined, 1 if all of the selection is double underlined, or -1 if part of the selection is double underlined or more than one kind of underlining is used.
:EditClear
Syntax: EditClear [Count]
Deletes the selection without changing the contents of the Clipboard. If the selection is an insertion point, deletes the character to the right of the insertion point. If Count is supplied, deletes the specified number of characters from the right of the insertion point. If Count is a negative number, deletes to the left of the insertion point.
:EditCopy
Syntax: EditCopy
Equivalent to the Copy command on the Edit menu. Copies the selection to the Clipboard.
:EditCut
Syntax: EditCut
Equivalent to the Cut command on the Edit menu. The selection is placed on the Clipboard and then deleted.
:EditGlossary
Syntax: EditGlossary Name$, [Context]
(HACKER'S GUIDE ALERT: > Use Guy Gallo's ExpandGlossary and Edit Glossary which strip formatting before inserting things in the glossary to avoid problems; see additional notes in HG).
Equivalent to the Glossary command on the Edit menu. Used to define, delete, and insert glossary entries. Context can be 0 (zero) for global or 1 for document template. The default is global.
The default action is Insert. You can perform other actions by appending the command button name from the dialog box (Define or Delete) to the statement.
STATEMENT: EditGlossary "CPR" , .Context = 1
EFFECT: Inserts the template-specific glossary entry named "CPR"
STATEMENT: EditGlossary "CPR" , .Context = 0
EFFECT: Inserts the global glossary entry named "CPR"
STATEMENT: EditGlossary "CPR" , .Define
EFFECT: Defines the glossary entry named "CPR"
STATEMENT: EditGlossary "CPR" , .Delete
EFFECT: Deletes the glossary entry named "CPR"
:EditGoTo
Syntax: EditGoTo Destination$
Equivalent to the Go To command on the Edit menu. Destination$ is a bookmark name or goto string. See the special bookmarks in the preceding section and Moving the Insertion Point in the User's Reference for more information on bookmarks.
STATEMENT: EditGoTo "Disclaim"
EFFECT: Moves the insertion point to the bookmark "Disclaim"
STATEMENT: EditGoTo "\StartOfDoc"
EFFECT: Uses a special bookmark to move the insertion point to the beginning of the document. (HACKER'S GUIDE ALERT: > can also go to specific page with page no or "p" plus a number. To go to a page numbered 3 that is not physical page 3, Indicate page and section no.; i.e. "S2P3").
Equivalent to the Header/Footer command on the Edit menu. Opens the header or footer pane for editing. (HACKER'S GUIDE ALERT:> only opens header or footerpane if ViewPage turned OFF. If ViewPage is ON, it will kick you up or down to header or footer on current page. Use in conjunction with ClosePane to edit headers and footers with ViewPage OFF).
The following table summarizes the arguments. The arguments correspond to a check box. If the argument is 1, the check box is on. If the argument is 0 (zero), the check box is off.
Argument Description
Type Specifies header or footer
StartingNum[$] Value at which to start page numbers
NumFormat Format for page numbers, as described in the following table.
HeaderDistance[$] Distance from top of page in points
FooterDistance[$] Distance from the bottom of the page in points
FirstPage Corresponds to Different First Page Pages check box
Links the header/footer with a previous section. This is not possible in the first section of a document. [HACKER'S GUIDE ALERT: > The mysterious "Link" they are talking about here is basically just page numbering. If you set up a section with separate page numbering, then change your mind and want to go back to "normal" page numbering, you run an EditHeaderFooterLink. That copies in the text from the previous header or footer, deleting the "new page numbering" info. If you want to delete everything in a header or footer and unlink it - your best bet is to leave something (like a space) in the header or footer. Otherwise it won't unlink. I've had trouble running this guy with View Page ON.]
:EditPaste
Syntax: EditPaste
Equivalent to the Paste command on the Edit menu. Copies the contents of the Clipboard to the insertion point.
:EditPasteLink
Syntax: EditPasteLink [AutoUpdate]
Equivalent to the Paste Link command on the Edit menu. Pastes a DDE (Dynamic Data Exchange) field. If AutoUpdate is 1, EditPasteLink pastes a DDEAUTO field.
For information on DDE, see Macros: Introduction and Fields.
:EditPic
[HACKER'S GUIDE ALERT: >
This is an undocumented WordBASIC command. Function: who knows?]
Equivalent to the Replace command on the Edit menu. Replaces the Search$ string with Replace$. If Search$ and Replace$ are not supplied, the strings used in the previous search and/or replace are used.
The following table summarizes the arguments. Each argument corresponds to a check box.
Argument Description
--------------- ------------------
WholeWord Corresponds to the Whole Word check box
MatchCase Corresponds to the Match Upper/Lowercase check box.
Confirm Corresponds to the Confirm Changes check box
Format Replaces formatting in addition to, or instead of, text
To replace formatting in addition to, or instead of, text, use EditReplaceChar, EditReplacePara, EditSearchChar, or EditSearchPara first to set up the formatting, then run EditReplace or EditSearch with Format set to 1.
[HACKER'S GUIDE ALERT: > This just starts at the current cursor location, and heads toward the end of the document, replacing as it goes. If you use .Confirm=0 and you want to replace all the occurrences of a string, make very, very sure you start at StartOfDocument, or use SendKeys to force EditReplace to loop all the way through the document, i.e.,
SendKeys("%Y")
EditReplace "Foo", "Bar", .Confirm=0
Be leery of doing a lot of replacing from inside your own home-grown macro. The problem is the "Undo" buffer: WinWord only allocates a small amount of memory to keep track of changes (so you can "Undo" all the changes with one click). If you have a bunch of EditReplace "hits", the Undo buffer can fill very quickly, and your macro will simply crash and burn with a message advising the user to save changes and exit WinWord. (As I recall, this message comes up without tripping the usual WinWord "On Error" conditions.) Doesn't matter how much memory you have on the machine - WinWord isn't smart enough to use all of it.
The Search$ and Replace$ strings in EditReplace are limited to 255 characters. If you need to replace something larger than 255 characters, try this:
EditSearch "Whatcherlookinfer"
If EditSearchFound() Then
EditClear
Insert "Thestringlongerthan255characters"
End If
It's particularly important to keep the 255-character limitation in mind if you are automatically selecting text elsewhere, and don't know offhand if it can exceed 255 bytes.]
Defines the paragraph formatting EditReplace uses to format replacement text. The arguments specify options available in the Format Paragraph dialog box. See "FormatParagraph," later in this section.
Equivalent to the Search command on the Edit menu. Searches for the specified Search$.
The following table summarizes the arguments. The arguments correspond to a check box. If the argument is 1, the check box is on. If the argument is 0 (zero), the
check box is off.
Argument Description
--------------- -------------------
WholeWord Corresponds to the Whole Word check box
MatchCase Corresponds to the Match Upper/Lowercase check box
Direction 0 searches toward beginning of document, without prompt; 1 searches toward end of document, with prompt (default); 2 searches toward end of document, without prompt
Format Replaces formatting in addition to, or instead of, text; 0 ignores formatting (default), 1 uses formatting
[HACKER'S GUIDE ALERT: > James Gleick reports that he has encountered situations where an EditSearch in a long document hangs the system - the hourglass goes on and won't go off. What the Tech Ref is talking about when it says "with prompt" or "without prompt" is the "Reached End of Document, Continue at Beginning?" prompt. I have encountered situations where the default .Direction is NOT the last .Direction used. Better to specify it each time.]
Defines the paragraph formatting EditSearch and EditReplace use to find formatted text. The arguments specify options available in the Format Paragraph dialog box. See "Format Paragraph," later in this section.
Equivalent to the Summary Info command on the Edit menu. Sets the summary information and allows access to the Statistics dialog box. All the options in the Statistics dialog box are read─only except for the total editing time, which can be set with WordBASIC.
You can append the Update command button name to update the summary information.
Argument Description
--------------- ------------------
Title$ Title
Subject$ Subject
Author$ Author
Keywords$ Key words used to identify the document
Comments$ Comments on the document
Directory$ The document's directory location; read only
Template$ Document template
CreateDate$ Creation date; read-only
LastSavedDate$ Date the document was last saved;read-only
LastSavedBy$ Name of the person last saving the document; read-only
RevisionNumber Number of times the document has been saved; read-only
EditTime$ Total time the document has been open
LastPrintedDate$ Date document was last printed; read-only
NumPages Number of pages; read-only
NumWords Number of words; read-only
NumChars Number of characters; read-only
FileName$ Makes changes to summary information for specified file name
[HACKER'S GUIDE ALERT: > Several places it says ".Comments$". It should be ".Comment$", without the "s". The .NumChars argument counts characters in headers, footers, footnotes, and annotations. The reason why this number is so different from the "FileSave" message in the Status Bar? The FileSave character counter only counts characters in the main part of the document. For some reason, NumPages is listed as numeric. It isn't. You need to use, e.g.,
NumberofPages=Val(dlg.NumPages)
NumWords and NumChars probably work the same way.]
:EditTable
Syntax: EditTable [Modify], [ShiftCells]
Equivalent to the Table command on the Edit menu. Modify is 0 (zero) for Row, 1 for Column, or 2 for Selection. ShiftCells is 0 for Horizontally or 1 for Vertically. You can delete, merge, or split cells by appending the Delete, MergeCells, or SplitCells command button name.
:EditUndo
Syntax: EditUndo
Equivalent to the Undo command on the Edit menu. Undoes the last action, if possible. You can undo certain Word actions, such as Cut and Paste. Some actions can't be undone.
:ElseIf
See "If"
:Else
See "If"
:EmptyBookmark()
Syntax: Log = EmptyBookmark(Name$)
Returns -1 if Name$ is empty (an insertion point), or 0 (zero) if Name$ is not empty.
:End Dialog
Syntax: End Dialog
Ends the definition of the dialog box.
:EndOfColumn
Syntax: EndOfColumn [Select]
Moves the insertion point to the bottom cell in the table column. If Select is a nonzero value, the selection is extended.
:EndOfDocument
Syntax: EndOfDocument [Select]
Moves the selection to the end of the document. If Select is a nonzero value, the selection is extended.
:EndOfLine
Syntax: EndOfLine [Select]
Moves the selection to the end of the line. If Select is a nonzero value, the selection is extended.
:EndOfRow
Syntax: EndOfRow [Select]
Moves the selection to the end of the last cell in the table row. If Select is a nonzero value, the selection is extended.
:EndOfWindow
Syntax: EndOfWindow [Select]
Moves the selection to the end of the window. If Select is a nonzero value, the selection is extended.
:End If
See "If"
:End Function
See "Function"
:End Select
See "Select"
:End Sub
See "Sub"
:Eof()
Syntax: Log = Eof(StreamNumber)
Returns -1 when the end of the file attached to the stream number has been reached.
:Err
Syntax: Num = Err
Syntax: Err = 0
This is a special variable that contains the error code for the most recent error condition. A list of error codes appears at the end of this chapter.
The form Err=0 is used to reset error trapping after an error has occurred.
:Error
Syntax: Error ErrorNumber
Generates an error condition specified by ErrorNumber. ErrorNumber is an error code. Error serves two functions. It can be used to generate a specified error condition in order to test an error handling routine, or it can be used to display an error message and terminate the operation of the macro program. More...
:ExistingBookmark()
Syntax: ExistingBookmark(Bookmark$)
Returns -1 if Bookmark$ exists, or 0 (zero) if not.
:ExitWindows
Syntax: ExitWindows
Exits Windows immediately without saving and returns to DOS. Use this statement with care. [HACKER'S GUIDE ALERT: > An undocumented WinWord command. And it works. Oh boy, does it!]
:ExpandGlossary
Syntax: ExpandGlossary
Expands the word closest to the insertion point into the corresponding glossary text.
:ExtendSelection
Syntax: ExtendSelection [Character]
Turns on extend mode, if it is not already turned on. If extend mode is already turned on, selection is extended to next unit; for example, if a character is selected, ExtendSelection extends the selection to the whole word. If Character is specified, the selection is extended to that character. [HACKER'S GUIDE ALERT: > If this command looks a little strange, it's because it does about a dozen different things depending on the context. Here's an example of ExtendSelection. It searches for a caret, turns on ExtendSelection, searches for the next caret, and clears out everything between the carets:
EditSearch .Search="^", .Direction=2
While EditSearchFound()
ExtendSelection
EditSearch .Search="^", .Direction=2
EditClear
EditSearch .Search="^", .Direction=2
Wend]
:File1, File2, File3, File4
Syntax: File1
Syntax: File2
Syntax: File3
Syntax: File4
Equivalent to selecting a listed file on the File menu. Opens the file. An error is generated if you attempt to open a nonexistent file slot. For example, you cannot use File4 if only three files are listed under the File menu.
:FileClose
Syntax: FileClose [Save]
Equivalent to the Close command on the File menu. Closes the current file and associated windows. The Save argument determines whether a save is forced: 1 forces a save, 2 forces no save.
:FileExit
Syntax: FileExit [Save]
Equivalent to the Exit command on the File menu. Quits Word. If any open documents have been edited and Save is omitted or is 0 (zero), you are prompted to save each changed document. If Save is 1, all edited documents are automatically saved before exiting. If Save is 2, the documents are not saved.
Equivalent to the Find command on the File menu. It can be used to change the search criteria in subsequent FileFind statements. If you record a macro with FileFind, any other actions you perform in the File Find dialog box at that time, such as opening or deleting a document, editing summary information, or printing, are also recorded. SortBy specifies what information the documents are sorted by; see following table
Argument Description
--------------- -------------------
SearchList$ List of existing directories
Title$ Title
Subject$ Subject
Author$ Author
Keywords$ Key words used to identify the document
SavedBy$ Name of the person saving the document
Text$ Text in the document
DateCreatedFrom$ Document creation date you want to search from
DateCreatedTo$ Document creation date you want to search to
DateSavedFrom$ Document save date you want to search from
DateSavedTo$ Document save date you want to search to
MatchCase Specifies whether to match the case of the search text exactly; 0 is no (default), 1 is yes
SearchAgain Specifies whether to begin the search again; 0 is no (default), 1 is yes
If SortBy is Word sorts files
----------------- ---------------------------
0 Alphabetically by name
1 Alphabetically by author
2 Chronologically by creation date
3 Chronologically by date last saved
4 Alphabetically by the name of the person who last saved the document
5 By size, with smallest document listed first
[HACKER'S GUIDE ALERT: > SearchList$ is limited to 255 characters. This can cause real, live bugs in the operation of FileFind. Avoid it if you can! Here's why: WinWord, if so instructed, will scan your entire disk for .DOC files. As it finds .DOC files, it appends the directory info for those "found" files to a string that appears at the top of the FileFind Search dialog box. When that string - of all stupid things - hits 255 characters, WinWord stops searching, and doesn't tell you! Bad bug. It's in DOS Word, too, if that's any consolation.]
:FileName$()
Syntax: A$ = FileName$(n)
Returns the nth file in the file list. If n is 0 (zero), the name of the current file is returned. If n is greater than the number of files in the file cache, an error is generated. If there is no current document, FileName$(0) returns an empty string.
:FileNew
Syntax: FileNew [Template$], [NewTemplate]
Equivalent to the New command on the File menu. The following table summarizes the arguments.
Argument Description
--------------- ------------------
Template$ Name of the document template on which to base the document
NewTemplate If 1, file is a document template; if 0, file is a document (default)
[HACKER'S GUIDE ALERT: > Note that there is a bug in FileNew. If you have a macro that runs the built-in function FileNew, and the user clicks "CANCEL" in the built-in FileNew, the "CANCEL" cannot be trapped by an On Error statement. Every other built-in function will let you trap "CANCEL" with an On Error.]
:FileOpen
Syntax: FileOpen Name$, [ReadOnly]
Equivalent to the Open command on the File menu. Opens the named document. An error is generated if the document does not exist. If ReadOnly is 1, the document is opened as read-only.
[HACKER'S GUIDE ALERT: > If you want to open all files as text - bypassing the "convert file from" dialog box - you need to use the SetConversionState macro or manually edit the WIN.INI file to set the conversion state to NO.
When opening text files or foreign formatted files, Word for Windows will normally prompt with a dialog asking for the file format to convert from. In order to bypass the prompt and have Word for Windows open all foreign formatted files as text files, the conversion state in the WIN.INI needs to be set to "No" or "Conversion=No".
A macro to change the conversion state in the WIN.INI file, is included in the Word for Windows EXAMPLES.DOC file. This macro is called SetConversionState, and can be installed by opening the EXAMPLES.DOC file and clicking on the Install button.
Once installed, choose SetConversionState from the Macro menu to enable or disable the conversion of foreign file formats. When the file format conversion is disabled, all foreign files will load as text files.
The conversion state can also be set manually by editing the Microsoft Word section of the WIN.INI file.
[Microsoft Word]
Conversion=No
The above lines will disable the file format dialog when importing foreign formatted files, so that all files load as text.
[Microsoft Word]
Conversion=Yes
This setting will enable the file format conversion prompt when opening foreign formatted files.]
Equivalent to the Print command on the File menu. Prints a document. The following table summarizes the arguments.
Argument Description
--------------- -------------------
Type Type of document to print; can be 0 for document, 1 for summary information, 2 for annotations, 3 for style sheet, 4 for glossary, or 5 for key assignments
NumCopies Number of copies
Range Page range; 0 prints all of the document, 1 prints the selection, 2 prints the specified range of pages
From$ Beginning of the range; can be page and/or section; ignored if Range equals 1 (selection)
To$ End of the range; can be page and/or section; ignored if Range equals 1 (selection)
Reverse 0 prints the document from the first page to the last; 1 prints the document in reverse order
Draft Prints in draft mode
UpdateFields Updates fields before printing; some fields are automatically updated at printing; this argument updates fields not normally updated
Summary Instructs Word to include summary information
Annotations Instructs Word to include annotations
ShowHidden Instructs Word to include hidden text
ShowCodes Instructs Word to show field codes
FileName$ If supplied, the specified file is printed; used by FileFind
[HACKER'S GUIDE ALERT: > This is one of the quirkiest functions in WordBASIC. Be ready for lots of surprises. If you're going to print a long document, there are a couple of tricks.
First, you should never run WinWord maximized when you're printing a long document. Why? The hourglass will stare at you. Make WinWord just a little smaller than full-window, and you'll be able to click outside of WinWord, and at least play a round of Solitaire while you're waiting for the printer. Second, you can automatically resize WinWord by changing your FilePrint macro to do this:
AppMove 0,0
AppSize 300,300
Dim dlg as FilePrint
GetCurValues dlg
On Error Goto mEnd
Dialog dlg
SuperFilePrint dlg
mEnd:
Third, PrintManager won't take more than 20 "jobs". If you run FilePrint more than 20 times without any pages printing, the PrintManager will object - saying it can't take any more - but WinWord will keep on plugging out pages. If WinWord is running in a full window, there's nothing you can do but keep clicking OK at the PrintManager's admonitions. Printing a range of pages is quite an art, if you have multiple sections that restart the page number. The only tricks I've found to work is to either go through the document and wipe out the "Start with new page number" part of all section breaks, or to somehow futz with the .From$ and .To$ settings. Valid .From$ and .To$ settings include "p3s2" or "3s2", both indicating page 3 of section 2.
Oh - selecting an entire page, then printing it will print the headers and footers of the first page of that section, not the headers and footers of the selected page.
Bug alert: If you have EPS file support, and you run FilePrint but cancel it, your ruler will change from inches (or whatever) to points! That's a world-class weird bug. To fix it, edit your FilePrint macro, add one line after "Bye:"
If FilePrintPreview()=0 Then UtilCustomize .Units=SavedUnit
NB.: this only happens with EPS support installed.
There is a problem printing with "mixed" bins on the IIID. I think it also happens with the IIISi and IID, but haven't been able to confirm it.
The problem: "mixed" bin selection works right the first time (i.e., FilePrint .PaperFeed=7). But it doesn't work right the second (or subsequent) time.
Solution: use this instead of FilePrint .PaperFeed=7
SendKeys("%O%em{Enter}")
FilePrint
(Notes: That's a capital letter "Oh", there is no % in front of the "m", and the curly brackets around the "Enter" are just typed at your keyboard - no insert field funnies.)
This little SendKeys kludge manually selects the Option button, then picks "mixed". If you manually select "mixed" this way every time, the printer will print mixed.
I warned you that FilePrint is quirky!]
:FilePrinterSetup
Syntax: FilePrinterSetup [Printer$]
Equivalent to the Printer Setup command on the File menu. Printer$ is the name of the new printer to be activated. Enter this argument exactly as it appears in the File Printer Setup dialog box.
The Setup command button name can be appended to display the dialog box
showing the printer options.
FUNCTION: FilePrinterSetup "Apple LaserWriter Plus on COM2:"
RESULT: Changes the printer to the Apple LaserWriter Plus attached to the COM2: port
[HACKER'S GUIDE ALERT: > Be very, very cautious when writing SendKeys parameters for FilePrinterSetup. It's a jungle. You CANNOT assume that if your SendKeys works on all the major printers, it will necessarily work on all the lesser printers. And SuperPrint screws everything up.
Caveat Hacker!: The FilePrinterSetup discussion should be prefaced by a classic remark: Abandon hope, all ye who enter here..... When you embark on FilePrinterSetup stuff, you are indeed entering the first ring of Hell.]
:FilePrintMerge
Syntax: FilePrintMerge [From], [To]
Equivalent to the Print Merge command on the File menu. If From or To is nonzero, Word merges the specified records only.
:FilePrintPreview
Syntax: FilePrintPreview [On]
Equivalent to the Print Preview command on the File menu. Without On, toggles print preview mode. If On is nonzero, turns on print preview mode; if On is 0 (zero), turns off print preview mode.
[HACKER'S GUIDE ALERT: > When FilePrintPreview is on, you cannot use a macro to work with bookmarks. Why? I dunno. There has been a lot of discussion about automatically maximizing the WinWord screen before running FilePrintPreview. The problem stems from the odd way Winword handles AppMaximize. (And I'm sure it doesn't help that the normal way of leaving FilePrintPreview mode is to CANCEL!) Very strange behavior. Here's the latest I have, by way of a solution:
If AppMaximize()=0 then AppMaximize
FilePrintPreview 1
Input "Press Enter to exit Print Preview", A$
FilePrintPreview 0
AppRestore
That's a real kludge, because you can't DO anything in FilePrintPreview, and it changes the way FilePrintPreview works (i.e., it requires you to push enter to get out, in spite of the beautiful CANCEL button up at the top). Yecch.
Another alternative:
If AppMaximize()=0 Then AppMaximize
FilePrintPreview
If FilePrintPreview()=0 Then AppRestore
Which isn't much better. Oh - there's a typo in FilePrintPreview$(). The example should say:
A=FilePrintPreview() 'cuz it returns an integer.]
:FilePrintPreviewBoundaries
Syntax: FilePrintPreviewBoundaries [On]
Displays the text boundaries if On is nonzero; turns off display if On is 0 (zero). If On is omitted, toggles the display of text boundaries.
:FilePrintPreviewPages
Syntax: FilePrintPreviewPages [Pages]
Without the argument, toggles display between one and two pages.
Pages arg Description
---------------- -------------------
0 Toggles the display state (default)
1 One page
2 Two pages
:FileSave
Syntax: FileSave
Equivalent to the Save command on the File menu. Saves the current document.
:FileSaveAll
Syntax: FileSaveAll [Save]
Equivalent to the Save All command on the File menu. Prompts the user to save all changed files including NORMAL.DOT. If Save is 1, all edited documents are automatically saved. If Save is 2, the documents are not saved.
Equivalent to the Save As command on the File menu. Saves the current document with a new name and/or format. Name$ specifies the new name. Format specifies the new format.
Argument Meaning
FastSave Saves changes made since last save
CreateBackup Creates a backup copy of the document
LockAnnot Locks the document for annotations
Format Document type
----------- ------------------------
0 Normal (Word format)
1 Document Template
2 Text Only (extended characters saved in ANSI character set)
3 Text+Breaks (plain text with line breaks; extended characters saved in ANSI character set)
4 Text Only (extended characters saved in IBM PC character set)
5 Text+Breaks (text with line breaks; extended characters saved in IBM PC character set)
6 Rich Text Format (RTF)
Other file formats can be specified. They must be listed in your WIN.INI file under the Microsoft Word entry.
[HACKER'S GUIDE ALERT: > WinWord normally saves all documents in "Fast Save" format. Older versions of Grammatik, among other programs, have trouble dealing with Fast Save format files. (Selecting Create Backup automatically disables the Fast Save option.)
If you change your FileSaveAs macro to:
Dim dlg As FileSaveAs
GetCurValues dlg
dlg.FastSave=0 <--------New Line
On Error goto Done
Dialog dlg
Super FileSaveAs dlg
Done: <--------New Line
You'll disable Fast Save.
If you want to have a macro save the active document under a new name but skip the Summary Info dialog box - even when Customize has "Prompt for Summary Info" - here's how to do it
Dim dlg as EditSummaryInfo
GetCurValues dlg
temp=dlg.SummaryPrompt
EditSummaryInfo .SummarPrompt=0
FileSaveAs .Name="Foobar"
EditSummaryInfo .SummaryPrompt=temp]
:Files$()
Syntax: A$ = Files$(FileSpec$)
Returns the first filename matching FileSpec$. If FileSpec$ is not supplied, the next file matching the last-used FileSpec$ is returned. This function can be used to get a list of files matching a FileSpec$ by specifying the FileSpec$ on the first iteration, and then omitting it thereafter. If no files match, a null string ("") is returned. [HACKER'S GUIDE ALERT: > FileSpec$ is limited to a max of 255 characters.]
Function Return value
-------------- ---------------------
A$ = Files$("WIN.*") WIN.DOC, WIN.COM, WIN.TXT or any file with the name WIN.
:Font
Syntax: Font Name$, [Size]
Applies the named font to the selection. You can include the Size argument instead
of following this statement with the FontSize statement.
:Font$( )
Syntax: A$ = Font$( )
Returns the font name of the current selection. If the selection has more than one font, a null string is returned.
:FontSize()
Syntax: Num = FontSize()
Returns the font size of the current selection. If the selection has more than one font size, 0 (zero) is returned.
:FontSize
Syntax: FontSize Size
Sets the size of the current selection in points.
:For...Next
Syntax: For CounterVariable = Start To End [Step Increment]
Statements
Next [CounterVariable]
Executes the statements between For and Next as many times as it takes the CounterVariable to go from the Start value to the End value. Increment is the value used to increment the counter (default is 1).
The CounterVariable with Next is optional. If CounterVariable is omitted, Next causes WordBASIC to loop back to the first incompleted For...Next statement. More....
Equivalent to the Character command on the Format menu. Applies character formatting to the selection. The following table summarizes the arguments. Some arguments take measurements in points. Other arguments correspond to a check box.
Argument Description
--------------- -------------------
Font$ Name of font
Points[$] Size in points
Color Color of the text; see CharColor in "Other Command Equivalents" for a list of colors
Bold Corresponds to the Bold check box
Italic Corresponds to the Italic check box
SmallCaps Corresponds to the Small Kaps check box
Hidden Corresponds to the Hidden check box
Underline Corresponds to the Underline check box
WordUnderline Corresponds to the Word Underline check box
DoubleUnderline Corresponds to the Double Underline checkbox
Position[$] Refers to the character position on the line, as shown in the table that follows
Spacing[$] Specifies the amount of character spacing in points, as shown in the table that follows
Position[$] arg Position
------------------------ -------------
Zero Normal
A positive number Superscript the specified number of points
A negative number Subscript the specified number of points
Spacing[$] arg Spacing
----------------------- -------------
Zero Normal
A positive number Expanded
A negative number Condensed
[HACKER'S GUIDE ALERT: > The weird [$] thing that follows the Points, Position, and Spacing arguments just mean that you can use either character or numeric values. For example, these are identical:
FormatCharacter .Points="14"
FormatCharacter .Points=14
Note that the "$" is never attached to the argument name.
There's a weird bug in FormatCharacter. Unless you change the arguments, it always comes up with a "0 point Superscript". That just happens to be the same thing as "normal", but try explaining that one to a novice! Easy solution:
Defines a new style with the specified Name$. If a style with that name already exists, that style is made the current style. FormatDefineStyles sets up the style; to define the character, paragraph, and tab formats, use the FormatDefineStylesChar, FormatDefineStylesPara, and FormatDefineStylesTabs statements described later in this section. To redefine an existing style, include the specific arguments with the FormatDefineStyles statement. Examples are shown in the following table:
STATEMENT: FormatDefineStyles "Title"
EFFECT: Defines the new style "Title"
STATEMENT: FormatDefineStylesChar .Bold = 1
EFFECT: Redefines the current style to include bold text
STATEMENT: FormatDefineStylesPara .Alignment = 2
EFFECT: Redefines the current style ("Title") to include centered text
STATEMENT: FormatDefineStyles "Headline" .Delete
EFFECT: Deletes the style "Headline"
The BasedOn$ argument specifies a style on which to base the new style. The NextStyle$ argument specifies the style to be applied after the new style.
AddToTemplate can be 0 for the document only, or 1 for the document and its template.
The Delete, Rename, and Merge command button names can be appended.
The NewName$ argument specifies a new name for the style; it is used only in conjunction with the Rename command button.
The FileName$ argument is used only with the Merge command button. It specifies the template or document whose style sheet is to be merged with that of the current document or template.
Source is used only in conjunction with the Merge command button name, and can be 0 (zero) (from the current document or template to a specified document or template) or 1 (from a specified document or template to the current document or template).
:FormatDefineStylesChar
Defines the current style with the specified character properties. This statement takes the same arguments as its corresponding format function. See "FormatCharacter," earlier in this section.
:FormatDefineStylesPara
Defines the current style with the specified paragraph properties. This statement takes the same arguments as its corresponding format function. See "FormatParagraph," later in this section.
:FormatDefineStylesPosition
Defines the current style with the specified position properties. This statement takes the same arguments as its corresponding format function. See "FormatPosition," later in this section.
:FormatDefineStylesTabs
Defines the current style with the specified tab properties. This statement takes the same arguments as its corresponding format function. See "FormatTabs," later in this section.
Equivalent to the Document command on the Format menu. Applies document formatting properties.
The following table summarizes the arguments. Some arguments take measurements in points. Other arguments correspond to a check box.
Argument Description
--------------- --------------------
PageWidth[$] Width of page
PageHeight[$] Height of page
DefTabs[$] Distance between default tab stops
TopMargin[$] Width of top margin
BottomMargin[$] Width of bottom margin
LeftMargin[$] Width of left margin
RightMargin[$] Width of right margin
Gutter[$] Binding width
MirrorMargins If 1, LeftMargin becomes InsideMargin and RightMargin becomesOutsideMargin
FootnotesAt Where to place footnotes; can be 0 for end of section, 1 for bottom of page, 2 for beneath text, or 3 for end of document
StartingNum[$] Starting footnote number
RestartNum Corresponds to the Restart # Each Section check box
Template$ Document template
WidowControl Corresponds to the Widow Control check box
To set the global or template default, append the SetDefault command button name to this statement. This is a powerful argument that changes the default document properties to those specified in the statement.
[HACKER'S GUIDE ALERT: > The weird [$] thing that follows all of the arguments (!) just means that you can use either character or numeric values. For example, these are identical (if your unit of measurement is inches):
FormatDocument .TopMargin=0.5
FormatDocument .TopMargin="0.5 in"
FormatDocument .TopMargin="0.5" + Chr$(34)
Note that the "$" is never attached to the argument name.]
The LeftIndent[$], RightIndent[$], and FirstIndent[$] arguments specify the amount of left, right, and first-line indents, respectively. The Before[$] and After[$] arguments specify the amount of spacing above and below a paragraph, respectively. The LineSpacing[$] argument specifies the amount of spacing for all lines in a paragraph. The Style$ argument specifies a style to be applied to a paragraph. The KeepTogether and KeepWithNext arguments prevent page breaks within a paragraph and between paragraphs, respectively.
The PageBreak argument inserts a page break before printing the paragraph. The NoLineNum argument turns off line numbering for the paragraph.
[HACKER'S GUIDE ALERT: > Note that FormatParagraph affects the white space surrounding "Format Position" positioned pictures and paragraphs.
Note also that FormatParagraph can affect cell height in tables.
The weird [$] thing that follows most of the arguments just means that you can use either character or numeric values. For example, these are identical (if your unit of measurement is inches):
FormatParagraph .FirstIndent=0.5
FormatParagraph .FirstIndent="0.5 in"
FormatParagraph .FirstIndent="0.5" + Chr$(34)
Note that the "$" is never attached to the argument name.]
Equivalent to the Picture command on the Format menu. Applies picture formatting properties.
The following table summarizes the arguments. Some arguments take measurements in points. Other arguments correspond to check boxes.
Argument Description
--------------- -------------------
Border Same available values as Border for FormatParagraph
ScaleY,
ScaleX Amount to scale the picture; the measurement is a percentage
CropTop[$]
CropLeft[$],
CropBottom[$],
CropRight[$] Amount to crop the picture, in points; if a negative value is used, the picture is not cropped, but the amount of white space around the picture is increased
[HACKER'S GUIDE ALERT: > The weird [$] thing that follows the Crop arguments just means that you can use either character or numeric values. For example, these are identical (if your unit of measurement is inches):
FormatPicture .CropTop=0.5
FormatPicture .CropTop="0.5 in"
FormatPicture .CropTop="0.5" + Chr$(34)
Note that the "$" is never attached to the argument name.]
Applies position formatting to the selected paragraphs.
Argument Description
--------------- -------------------
Horizontal[$] Absolute distance in points; can be Left, Center, Right, Inside, or Outside
HRelativeTo Distance in points, relative to specified item (margin, page, or column); can be 0 for Margin, 1 for Page, or 2 for Column
Vertical[$] Absolute distance in points; can be Normal, Top, Center, or Bottom
VRelativeTo Distance in points relative to specified item (margin or page); can be 0 for Margin, or 1 for Page
DistanceFromText Amount of white space between a picture and text surrounding the picture
ParagraphWidth[$] Total line width of the paragraph; if 0, use width as calculated by Word
The Reset command button name can be appended to cancel the position formatting of the paragraphs.
[HACKER'S GUIDE ALERT: > See the Hacker's Guide "Most Commonly Asked WinWord Questions" for a step-by-step approach to positioning a picture. The same procedure works for other paragraphs, too.
When a paragraph contains only a picture, Format Position works as one would expect: the paragraph is "cropped" (for lack of a better term) to the size of the picture, to facilitate moving it around in Page Preview.
But when a paragraph contains text (or a dingbat), it is considered to extend to the full, pre-defined width of the paragraph (which defaults to six inches). That's why people working with Drop Caps have to do a Format Paragraph to trim the para (in this case of Drop Caps, the entire paragraph is just one letter) down to size, before moving it around in Page Preview.
The paragraph width in Format Position needs to be set to the width of the drop cap or character (e.g., 0.5 inches), in order to get text beside the letter. Hopefully drop caps will be a little more straight forward in the future. For now, set the paragraph width in Format Position.
The weird [$] thing that follows the Horizontal, Vertical and ParagraphWidth arguments just means that you can use either character or numeric values. For example, these are identical (if your unit of measurement is inches):
FormatPosition .Horizontal=0.5
FormatPosition .Horizontal="0.5 in"
FormatPosition .Horizontal="0.5" + Chr$(34)
Note that the "$" is never attached to the argument name.]
Equivalent to the Section command on the Format menu. Applies section formatting properties to the selection. Some arguments take measurements in points or numbers. Other arguments correspond to check boxes.
Argument Description
--------------- -------------------
Columns Number of columns
ColumnSpacing[$] Distance between columns
ColLine Corresponds to the Line Between check box
SectionStart Determines where the section properties take effect; can be 0 (no break), 1 (column), 2 (page), 3 (even page), or 4 (odd page)
Footnotes Corresponds to the Include Footnotes check box.
LineNum Corresponds to the Line Numbering check box.
StartingNum[$] Number at which to begin line numbering
FromText[$] Distance from text; can be 0 (Auto) or a positive number
CountBy Increment at which to print line numbers
NumMode Determines how pages are numbered; can be 0 (per page), 1 (per section), or 2 (continuous)
VertAlign Alignment of section to the page; can be 0 (top), 1 (center), or 2 (justify)
[HACKER'S GUIDE ALERT: > When choosing Format Section and selecting Line Numbers, the line numbers will be clipped if you have a left margin < 0.62 inches. Minimum left margin for two-digit line numbers is 0.62 inches. Minimum for three-digit numbers is 0.72 inches. Minimum for four-digit line numbers is 0.82 inches.
The weird [$] thing that follows several of the arguments just means that you can use either character or numeric values. For example, these are identical (if your unit of measurement is inches):
Note that the "$" is never attached to the argument name.]
:FormatStyles
Syntax: FormatStyles Name$, [Create]
Equivalent to the Styles command on the Format menu. Applies the style in Name$ to the selected paragraphs. If the style does not exist and Create is not specified or is 0 (zero), an error is generated. If Create is specified as 1, the style is created with the properties of the selection, if it doesn't already exist.
Equivalent to the Table command on the Format menu. When recording, pressing the Next or Prev Columns command button records a new FormatTable command.
Argument Description
--------------- -------------------
FromColumn,
Column Range of columns
ColumnWidth Width of columns in points
SpaceBetweenCols[$] Space between columns in points
IndentRows[$] Indent in points
MinimumRowHeight Minimum row height in points
OutlineBorder,
TopBorder,
BottomBorder,
InsideBorder,
LeftBorder,
RightBorder Borders can be 0 (none), 1 (single), 2 (thick), or 3 (double)
AlignRows Alignment can be 0 (left), 1 (right), or 2 (center)
ApplyTo 0 applies the formatting to the selection; 1 applies the formatting to the entire table
[HACKER'S GUIDE ALERT: > The weird [$] thing that follows several of the arguments just means that you can use either character or numeric values. For example, these are identical (if your unit of measurement is inches):
FormatTable .SpaceBetweenCols=0.5
FormatTable .SpaceBetweenCols="0.5 in"
FormatTable .SpaceBetweenCols="0.5" + Chr$(34)
Note that the "$" is never attached to the argument name.]
:FormatTabs
Syntax: FormatTabs [Position], [Align], [Leader]
Equivalent to the Tabs command on the Format menu. Position is a measurement
in points.
Align arg Alignment
-------------- ----------------
0 Left
1 Centered
2 Right
3 Decimal
Leader arg Leader character
----------------- ----------------------------
0 None
1 Dot
2 Dash
3 Underline
Set is the default action. You can also clear specified tabs or clear all tabs by appending the Clear or ClearAll command button name to the statement. Recording a set of tab actions generates new commands, as shown in the following example:
STATEMENT: FormatTabs .ClearAll
EFFECT: Clears all tabs
STATEMENT: FormatTabs "1.5 in", .Set
EFFECT: Positions right-aligned tab at 1.5-inch interval
STATEMENT: FormatTabs "3 in", .Clear
EFFECT: Clears the tab at 3 inches
STATEMENT: FormatTabs "4.5 in"
EFFECT: Positions a tab at 4.5 inches
:Function...End Function
Syntax: Function Name [ParameterList]
Statement(s)
End Function
Defines a function. The ParameterList is a list of variables, separated by commas, for receiving arguments to the function. For more information on user-defined functions, see Macros: Introduction.
:GetBookmark$()
Syntax: A$ = GetBookmark$(BookmarkName$)
Returns the text at the specified bookmark.
:GetCurValues
Syntax: GetCurValues DialogRecord
Stores in DialogRecord the current values for a previously dimensioned dialog box. For more information, see Macros: Introduction.
:GetGlossary$()
Syntax: A$ = GetGlossary$(Name$, [Context])
Returns the text of the glossary entry in Name$. The Context is 0 (zero) for global (default) or 1 for document template.
FUNCTION: New$ = GetGlossary$("Disclaim", 1)
Print New$
EFFECT: Sets New$ to the text in the document template glossary specified by
the name "Disclaim" and prints the text.
:GetProfileString$()
Syntax: A$ = GetProfileString$([App$], Key$)
Gets a value from the current WIN.INI file. App$ is the name of the Microsoft Windows application. If the application is not specified, the string [Microsoft Word] is used. If the Key$ is not found, the function returns a null string.
Returns the name of the glossary defined in the given context (global or document template). Count must be in the range from 1 to CountGlossaries(Context). The name is taken from the list in the given context. Context is 0 (zero) for global, 1 for document template.
:GoBack
Syntax: GoBack
Toggles among the last three selections where text or formatting has changed.
:Goto
Syntax: Goto Label/LineNumber
Branches unconditionally to a label or line number. (HACKER'S GUIDE ALERT:>.at most one space before label, one space after, then colon, no tabs).
:GroupBox
Syntax: GroupBox x, y, dx, dy, Text$
GroupBox 60, 29, 32, 37, "Status"
Creates a box with a title. A GroupBox does not have a result. (HACKER'S GUIDE ALERT:>Text$ variable is req'd).
:GrowFont
Syntax: GrowFont
Increases the size of the selected font. Can be used either on the selection, or at the insertion point.
:HangingIndent
Syntax: HangingIndent
Sets the indent of the selection to the next tab stop in the first paragraph. Sets the first line of the paragraph flush with the left margin.
:Help
Syntax: Help
Activates Help. Equivalent to pressing F1.
:HelpAbout
Syntax: HelpAbout
Displays a dialog box with the Word version number and copyright information.
:HelpActiveWindow
Syntax: HelpActiveWindow
Activates Help for the active window.
:HelpContext
Syntax: HelpContext
Activates context-sensitive Help. Equivalent to pressing Shift+F1.
:HelpIndex
Syntax: HelpIndex
Displays the list of Help topics.
:HelpKeyboard
Syntax: HelpKeyboard
Displays list of keyboard Help topics.
:HelpTutorial
Syntax: HelpTutorial
Starts the Tutorial.
:HelpUsingHelp
Syntax: HelpUsingHelp
Displays Help topics on how to use Help.
:Hidden
Syntax: Hidden [On]
Without an argument, toggles hidden text for the entire selection. If On is nonzero, makes the entire selection hidden text if the first character is hidden. If On is 0 (zero), removes hidden text from the entire selection.
:Hidden()
Syntax: Num = Hidden()
Returns 0 (zero) if none of the selection is hidden text, 1 if all of the selection is idden text, or -1 if part of the selection is hidden text.
:HLine
Syntax: HLine [Count]
Scrolls horizontally to the right by Count lines. If Count is not specified, one line is
the default. "Lines" mean the amount the screen is scrolled by clicking the mouse in a horizontal scroll bar arrow. A negative Count scrolls to the left.
:HPage
Syntax: HPage [Count]
Scrolls horizontally by Count screens. If Count is not specified, one screen is the default. A negative Count scrolls to the left.
:HScroll
Syntax: HScroll Percentage
Scrolls horizontally the specified percentage of the document width.
:HScroll()
Syntax: Num = HScroll()
Returns the current horizontal scroll position as a percentage of the document width.
:IconBarMode
Syntax: IconBarMode
Activates icon bar mode.
:If/ElseIf/Else/End If
Syntax: If Condition Then Statement(s)
Syntax: If Condition1 Then
Statement(s)
[ElseIf Condition2 Then
Statement(s)
[Else Statement(s)]
End If
Performs conditional execution or branching, depending on the expressions. The conditions in an If...ElseIf...Else...End If block can be any numeric expressions in WordBASIC For more information, see Macros: Introduction.
:Indent
Syntax: Indent
Indents the selection. The indent is aligned with the next tab stop. Indent does not change a first-line indent.
Reads a line from the file specified by #StreamNumber into the variables listed. The line read from the file is separated into individual values by commas. If a StreamNumber is not specified, you are prompted in the status bar.
:Input$()
Syntax: A$ = Input$(n, StreamNumber)
Reads n characters from the file specified by StreamNumber.
Displays an editable dialog box. Returns the text that was in the box when OK was chosen. If you specified a default, it is loaded into the dialog box when it is displayed.
[HACKER'S GUIDE ALERT: > Prompt$, Title$ and Default$ are all limited to a total of 255 characters.
I don't know if the variable itself (equivalently, the input text) is also limited to 255 characters; try it if there's any chance somebody will type in that much.
The Gadflies had fun with this one a while back.
x$ = GetProfileString$("Test")
If x$ = "" Then
x$="&Ampersand"
SetProfileString("Microsoft Word", "Test", x$)
End If
x$=InputBox$("Edit ampersand", "Test", x$)
SetProfileString("Microsoft Word", "Test", x$)
Want to watch WinWord go hyperexponential? Ah, the chaos.....]
:Insert
Syntax: Insert Text$
Inserts the given text at the insertion point. Nonprinting characters are inserted as Chr$(n) statements.
Value Character inserted
-------------- ------------------------------
Chr$(11) Linefeed
Chr$(30) Nonbreaking hyphen
Chr$(31) Optional hyphen
Chr$(160) Nonbreaking space
:InsertBookmark
Syntax: InsertBookmark Name$
Equivalent to the Bookmark command on the Insert menu. Creates or deletes the named bookmark. If the Delete command button is appended, the bookmark is deleted. If Delete is not specified, the bookmark is created at the current selection. If you specify a nonexistent bookmark for deletion, an error is generated. [HACKER'S GUIDE ALERT: > Bookmarks are not allowed in headers or footers.
The name of a bookmark must be contain letters, numbers, or the _underline character; max 20 characters, and the first character must be alpha. (I.e., don't start a bookmark name with a number!)]
:InsertBreak
Syntax: InsertBreak Type
Equivalent to the Break command on the Insert menu. Inserts a page, section, or column break at the current selection.
Type arg Break type
-------------- ------------------
0 Page
1 Column
The following are section breaks:
Type arg Break type
-------------- ------------------
2 Next
3 Continuous
4 Even
5 Odd
[HACKER'S GUIDE ALERT: > his one's a little tough to explain......
Say you're in a section. And that section has a specific starting page number. Let's call the starting page number "n". So far so good?
Now. Say you insert a section break inside that section. The page numbering is a little strange. The new section will start at page "n", no matter where in the section the break is inserted.
Confusing? Try debugging it!]
:InsertColumnBreak
Syntax: InsertColumnBreak
Inserts a column break at the insertion point. If the insertion point is in a table, the break is inserted above the row in which the insertion point is located.
:InsertDateField
Syntax: InsertDateField
Inserts a DATE field at the selection.
:InsertField
Syntax: InsertField Field$
Equivalent to the Field command on the Insert menu. Inserts the specified field at the selection. Do not include the field characters in Field$. For more information on inserting fields, see Fields.
:InsertFieldChars
Syntax: InsertFieldChars
Inserts field characters ({ }) at the selection.
:InsertFile
Syntax: InsertFile Name$, [Range$], [Link]
Equivalent to the File command on the Insert menu. Inserts the named file at the current selection.
Range$ refers to a bookmark if Name$ refers to a Word document. If Name$ refers to another document type (for example, a Microsoft Excel worksheet), then Range$ refers to a named range. Only that part of the file is inserted. If Link is 1, a link to the file is inserted instead of the actual file.
:InsertFootnote
Syntax: InsertFootnote [Reference$]
Equivalent to the Footnote command on the Insert menu. Inserts a footnote at the current selection.
Reference$ is footnote reference text that you supply.
To insert a footnote separator, continued footnote separator or notice for continued footnotes, append the Separator, ContSeparator, or ContNotice command button name.
Equivalent to the Index command on the Insert menu. Inserts an INDEX field at the current selection. Type is 0 (zero) for a normal index (default) or 1 for a run-in index. HeadingSeparator is 0 for none (default), 1 for a blank line, or 2 for a letter. If Replace is 1, the existing index is overwritten. If Replace is omitted or 0, the existing index is not overwritten.
[HACKER'S GUIDE ALERT: > Take a look at the {index} field, in the Hacker's Guide page 359. There's all sorts of fun stuff that can go bump in the night - most notably what happens when you have so many page numbers that they won't all fit on one line.]
Equivalent to the Index Entry command on the Insert menu. Inserts an XE field at the current selection. If Entry$ is omitted, the selection is the entry. The following table summarizes the arguments. The arguments correspond to check boxes.
Argument Description
--------------- -----------------------------
Bold Corresponds to the Bold check box
Italic Corresponds to the Italic check box
:InsertPageBreak
Syntax: InsertPageBreak
Inserts a page break at the current selection.
:InsertPageField
Syntax: InsertPageField
Inserts a PAGE field at the current selection.
:InsertPageNumbers
Syntax: InsertPageNumbers Type, Position
Inserts a current PAGE field into the header or footer.
Type is 0 (zero) for header, 1 for footer. Position is 0 (left aligned), 1 (centered), or 2 (right aligned).
:InsertPara
Syntax: InsertPara
Inserts a paragraph mark at the current selection.
:InsertPicture
Syntax: InsertPicture [Name$]
Equivalent to the Picture command on the Insert menu. Inserts an IMPORT field at the current selection. If Name$ is not supplied, a 1-inch graphic frame with a single border is inserted.
Equivalent to the Table Of Contents command on the Insert menu. Inserts a TOC Source is 0 (zero) for outline headings, or 1 for table entry fields. From and To refer to the outline levels used.
If Replace is 1, the existing table of contents is overwritten. If Replace is omitted or 0 (zero), the existing table of contents is not overwritten.
:InsertTableToText
Syntax: InsertTableToText [ConvertTo]
Converts the selected cells to normal text.
ConvertTo may be 0 (zero) for paragraphs, 1 for tab-delimited text, or 2 for comma delimited text.
:InsertTimeField
Syntax: InsertTimeField
Inserts a TIME field at the current selection.
:Instr()
Syntax: Num = Instr([n,] A$, B$) Note: corrected per Hacker's Guide..see below.
Searches for B$ in A$. Returns the number of the character where B$ started, or 0 (zero) if B$ is not found in A$. If n is supplied, the search starts at character n.
[HACKER'S GUIDE ALERT: > An important typo. It should read
Num=InStr([Index,] Source$, Search$)
Note that if you omit the [Index], you must omit the comma as well!]
:Int()
Syntax: Num = Int(n)
Returns the integer part of n.
Function Return value
------------- --------------------
Int(98.6) 98
Int(-9.6) -9
:IsDirty()
Syntax: Log = IsDirty()
Returns -1 if the document has been changed (made dirty) since the last save, 0 (zero) if the document has not been changed. [HACKER'S GUIDE ALERT: > ]Okay. I'm gonna step you through how to shoot yourself in the foot. If you misuse it, don't go blamin' me!
You can change Glossary entries - or anything else stored in NORMAL.DOT, for that matter - and still have your macro leave NORMAL.DOT "not dirty". (Why would you want to do that? To save your users from spending hours watching "Saving NORMAL.DOT 0% Complete".) Watch out. If you start muckin' around with IsDirty, you can clobber intentional mods to NORMAL.DOT.
After you're through doing whatever you want to do to NORMAL.DOT - add and delete a Glossary entry, for example - just run these two lines from a TEMPLATE macro:
FileOpen "normal.dot"
FileClose 2
You may have to add subdirectory info to "normal.dot".
:Italic
Syntax: Italic [On]
Without the argument, toggles italic for the entire selection. If On is nonzero, makes the entire selection italic. If On is 0 (zero), removes italic from the entire selection.
:Italic()
Syntax: Num = Italic()
Returns 0 (zero) if none of the selection is italic, 1 if all of the selection is italic, or -1 if part of the selection is italic.
:JustifyPara
Syntax: JustifyPara
Justifies the selected paragraphs.
:JustifyPara()
Syntax: Num = JustifyPara()
Returns 0 (zero) if none of the selected paragraphs are justified, 1 if all of the selected paragraphs are justified, or -1 if more than one kind of paragraph alignment is used.
:KeyCode
[HACKER'S GUIDE ALERT: > This is another undocumented WinWord command. Function unknown.]
:Key Macro$
[HACKER'S GUIDE ALERT: > Undocumented. Function unknown.]
:Kill
Syntax: Kill Name$
Deletes the file specified by Name$.
:LCase$()
Syntax: A$ = LCase$(A$)
Returns A$ converted to lowercase.
:Left$()
Syntax: A$ = Left$(A$, n)
Returns the leftmost n characters of A$.
Function Return value
-------------- ----------------------
A$ = "Legal File List"
Print Left$(A$,5) Legal
A$ = "Legal File List"
Print Left$(A$,10) Legal File
:LeftPara
Syntax: LeftPara
Left aligns the selected paragraphs.
:LeftPara()
Syntax: Num = LeftPara()
Returns 0 (zero) if none of the selected paragraphs are left aligned, 1 if all of the selected paragraphs are left aligned, or -1 if more than one kind of paragraph alignment is used.
:Len()
Syntax: Num = Len(A$)
Returns the number of characters in A$.
Function Return value
-------------- --------------------
A$="Trey Research"
Print Len(A$) 13
:Let
Syntax: [Let] Var = Expression
Assigns the value of an expression to a variable. Let is optional.
:LineDown
Syntax: LineDown [Repeat], [Select]
Moves the selection down by Repeat lines. If the Repeat argument is omitted, 1 is assumed. If Select is nonzero, the selection is extended down by Repeat lines.
:LineDown()
Syntax: Log = LineDown([Repeat], [Select])
Moves the selection down by Repeat lines. Returns 0 (zero) if the action cannot be completed.
[HACKER'S GUIDE ALERT: > LineDown() is broke and needs fixin'. Bad. Don't use it unless you have absolutely no other choice. LineDown(n), where n > 1, will return a FALSE if NO LineDown is possible. But it will return a TRUE if ANY LineDown is possible. Say what? Okay. Imagine your cursor is on line 2 of a three-line document. Your macro says:
If LineDown(5) MsgBox
"HeeHee. Gotcha!" Even though WinWord can't go down five lines - there's only one line left in the document - you'll still get a TRUE test, i.e., "HeeHee. Gotcha!"..Also watch out for an infinite loop testing LineDown() when the last line of a document is selected. I'm trying to figure this one out, myself, right now.]
:Line Input
Syntax: Line Input [#]StreamNumber, Variable$
Reads an entire line from the file specified by StreamNumber and puts the result in the specified string variable. If a StreamNumber is not specified, you are prompted in the status bar. Similar to the Input statement but LineInput doesn't break the line into separate values at commas.
:LineUp
Syntax: LineUp [Repeat], [Select]
Moves the selection up by Repeat lines. If the Repeat argument is omitted, 1 is assumed. If Select is nonzero, the selection is extended up by Repeat lines. If Select is 0 (zero) or omitted, the selection is not extended.
Statement Effect
---------------- ---------
LineUp 20 Moves the selection point up 20 lines from the insertion point, but does not extend the selection
:LineUp()
Syntax: Log = LineUp([Repeat], [Select])
Moves the selection up by Repeat lines. Returns 0 (zero) if the action cannot be completed. For example, the function would return 0 if the insertion point is at the beginning of the document.
:ListBox
Syntax: ListBox x, y, dx, dy, ArrayVariable$(), .Result$ Note: this is corrected per HG, see below.
Creates a list box control filled with the strings in ArrayVariable$. When the dialog box is used, .Result$ contains the current setting, your selected choice, returned from Dialog. [HACKER'S GUIDE ALERT: > That should read ListBox x, y, dx, dy, ArrayVariable$(), .Index
It isn't a .Field -- it's just a plain, old .Index into ArrayVariable$. Ignore the mumbo-jumbo.
The () parenthesis on ArrayVariable$() are required. Dumb.
A multi-dimensional array used as the ArrayVarriable$ argument will only display the first dimension. For example,
Dim MyArray$(10,100,100)
ListBox 8,20,400,12, MyArray$(), .Field
will only show the first-dimensioned ten items of MyArray$, i.e., MyArray$(0 thru 10, 0, 0) - I think.]
:LockFields
Syntax: LockFields
Prevents the fields within the selection from being updated.
Equivalent to the Assign to Key command on the Macro menu. You can assign a macro to any key or key combination.
Assigns the macro Name$ to the specified KeyCode. KeyCode is a number representing the exact key. The number is not equivalent to the SendKeys syntax.
Context is 0 (zero) for global or 1 for document template.
Assign is the default action. The ResetAll command button name can be appended to return the key assignments to the default state. The UnAssign command button name removes a macro connection to a specific key.
Add this for this key
------------- ------------------
1024 Alt +
512 Shift +
256 Ctrl +
[HACKER'S GUIDE ALERT: > To well and truly unassign an assigned key, you have to issue the command twice!
For some reason, Microsoft didn't document any but a small portion of the key codes. Here's the list I've compiled, after some exhaustive tests. Any code that is not on this list is not implemented - at least on my system (with a Northgate Omnikey Plus keyboard). And note that some keyboards map things a little differently.
For the key assignments where Guy and I didn't get the same results, extreme caution is urged. I dunno what's going on......
Note that these codes only apply to the MacroAssignToKey command. If you try to use about half these suckers from the Macro AssignToKey drop-down menu, you're out of luck.
3 Scroll Lock
8 Backspace
9 Tab
12 NumPad 5, with NumLock OFF
13 Enter
27 Esc
32 Space
33 PgUp Key
34 PgDn Key
35 End
36 Home
37 Left Arrow Key
38 Up Arrow Key
39 Right Arrow Key
40 Down Arrow Key
45 Insert Key
46 Delete Key
47 Help (?) (!)
48 0 (above the letters, not on the NumPad)
49 1 (above the letters, not on the NumPad)
50 2 (above the letters, not on the NumPad)
51 3 (above the letters, not on the NumPad)
52 4 (above the letters, not on the NumPad)
53 5 (above the letters, not on the NumPad)
54 6 (above the letters, not on the NumPad)
55 7 (above the letters, not on the NumPad)
56 8 (above the letters, not on the NumPad)
57 9 (above the letters, not on the NumPad)
58 : (colon)
59 ; (semicolon)
60 < (less than)
61 = (equals)
62 > (greater than)
63 ? (question mark)
64 @ (at sign)
65 a (lower case "a"; for upper case, use 512+65, i.e., Shift+"a")
66 b (lower case "b"; for upper case use 512 + 66, i.e., Shift+"b")
67 c (lower case "c; for upper case use 512 + 67, i.e., Shift+"c")
68 d (lower case "d"; for upper case use 512 + 68, i.e., Shift+"d")
69 e (lower case "e"; for upper case use 512 + 69, i.e., Shift+"e")
70 f (lower case "f"; for upper case use 512 + 70 , i.e., Shift+"f")
71 g (lower case "g"; for upper case use 512 + 71, i.e., Shift+"g")
72 h (lower case "h"; for upper case use 512 + 72, i.e., Shift+"h")
73 i (lower case "i"; for upper case use 512 + 73, i.e., Shift+"i")
74 j (lower case "j"; for upper case use 512 + 74, i.e., Shift+"j")
75 k (lower case "k"; for upper case use 512 + 75, i.e., Shift+"k")
76 l (lower case "l"; for upper case use 512 + 76, i.e., Shift+"l")
77 m (lower case "m"; for upper case use 512+77,i.e., Shift+"m")
78 n (lower case "n"; for upper case use 512 + 78, i.e., Shift+"n")
79 o (lower case "o"; for upper case use 512 + 79, i.e., Shift+"o")
80 p (lower case "p"; for upper case use 512 + 80, i.e., Shift+"p")
81 q (lower case "q"; for upper case use 512 + 81, i.e., Shift+"q")
82 r (lower case "r"; for upper case use 512 + 82, i.e., Shift+"r")
83 s (lower case "s"; for upper case use 512 + 83, i.e., Shift+"s")
84 t (lower case "t"; for upper case use 512 + 84, i.e., Shift+"t")
85 u (lower case "u"; for upper case use 512 + 85, i.e., Shift+"u")
86 v (lower case "v"; for upper case use 512 + 86, i.e., Shift+"v")
87 w (lower case "w"; for upper case use 512+87,i.e., Shift+"w")
88 x (lower case "x"; for upper case use 512 + 88, i.e., Shift+"x")
89 y (lower case "y"; for upper case use 512 + 89, i.e., Shift+"y")
90 z (lower case "z"; for upper case use 512 + 90, i.e., Shift+"z")
96 NumPad 0 with NumLock ON
97 NumPad 1 with NumLock ON
98 NumPad 2 with NumLock ON
99 NumPad 3 with NumLock ON
100 NumPad 4 with NumLock ON
101 NumPad 5 with NumLock ON
102 NumPad 6 with NumLock ON
103 NumPad 7 with NumLock ON
104 NumPad 8 with NumLock ON
105 NumPad 9 with NumLock ON
106 NumPad * (asterisk) or "special" * on Northgate keyboard
107 NumPad + (plus)
108 Tech Ref says ' on NumPad (I couldn't duplicate it)
109 NumPad - (minus; excellent choice for em-dash)
110 NumPad . (period)
111 NumPad / (slash)
112 F1
113 F2
114 F3
115 F4
116 F5
117 F6
118 F7
119 F8
120 F9
121 F10
122 F11 (Tech Ref says Alt-F11=Alt-F1; Windows limitation)
123 F12 (Tech Ref says Alt-F11=Alt-F1; Windows limitation)
124 F13 (Tech Ref says Alt-F11=Alt-F1; Windows limitation)
125 F14 (Tech Ref says Alt-F11=Alt-F1; Windows limitation)
126 F15 (Tech Ref says Alt-F11=Alt-F1; Windows limitation)
127 F16 (Tech Ref says Alt-F11=Alt-F1; Windows limitation)
186 Guy says this is a semicolon (I couldn't duplicate it)
187 Guys says = (Equals); I get + (Plus)
188 Guy says this is a comma (I couldn't duplicate it)
189 - (hyphen)
190 Guy says this is a period (I couldn't duplicate it)
191 Guy says this is a slash (I couldn't duplicate it)
192 Guy says this is the ` (I couldn't duplicate it)
219 Guy says this is the [ (I couldn't duplicate it)
220 Guy says this is the backslash \ (I couldn't duplicate it)
221 Guy says this is the ] (I couldn't duplicate it)
222 Guy says this is the ' (I couldn't duplicate it)]
Equivalent to the Assign To Menu command on the Macro menu.
Assigns the macro Name$ to the specified Menu$ with MenuText$. Menu$ can be File, Edit, View, Insert, Format, Utilities, Macro, or Window.
Context is 0 (zero) for global or 1 for document template.
Assign is the default action. You can append the ResetAll or UnAssign command button name to return the menu assignments to the default state or remove a macro from a menu.
:MacroDesc$
[HACKER'S GUIDE ALERT: > This is an undocumented - but very much present! - WinWord command. It's apparently related to the description displayed in the status bar when you select a macro; why it's undocumented, and how it's used, I dunno.]
Equivalent to the Edit command on the Macro menu. Displays the Name$ macro for editing. Context is 0 (zero) for global (default) or 1 for document template. The Description$ refers to the text that appears in the status bar if the macro is assigned to a menu.
The ShowAll argument lists all Word commands as well as the macros you have created.
If one of the command button names Rename, Delete, or Set is used and followed by another action, multiple MacroEdit commands are recorded.
The NewName$ agrument specifies a new name for the macro; this argument is used with the Rename command button.
:MacroName$()
Syntax: A$ = MacroName$(Count, [Context], [All])
Returns the name of the macro defined in the given context. Count may be in the range of 1 to CountMacros(Context). The name is taken from the list in the given context. MacroName$(0) gives the name of the current macro window, if any. Context is 0 (zero) for global or 1 for document template. If All is True, built-in commands are included.
Equivalent to the Record Macro command on the File menu and the Record command on the Macro menu. Starts the macro recorder. If Name$ is not given, the next default recording name (Macron) is used. Context is 0 (zero) for global default) or 1 for document template. The Description$ refers to the text that appears in the status bar if the macro is assigned to a menu. [HACKER'S GUIDE ALERT: > There appears to be no way to turn the macro recorder off from inside WordBASIC. You can pause it, however. Refer to PauseRecord.]
:MacroRun
Syntax: MacroRun Name$, [ShowAll]
Equivalent to the Run command on the Macro menu. Runs the named macro or command. If ShowAll is 1, built─in commands are included.
[HACKER'S GUIDE ALERT: > Is this command ever necessary?)
When writing macros, you will find that using Macro Run will consume much more memory than when using one macro with many subroutines. There is much more overhead (memory used) as a result of doing "macro run" versus calling a subroutine.
If you execute MacroRun of a macro stored in a template and the active window is not associated with that template, the driver macro simply stops.
One solution: save the current window name and Activate the template window before executing MacroRun. On return, Activate the saved window name:
Sub TemplateMacroRun(TemplateWindow$, MacroName$, XSaveAll)
SaveWindowName$ = WindowName$()
Activate TemplateWindow$
MacroRun MacroName$, XSaveAll
Activate SaveWindowName$
End Sub
It works pretty well unless the macro you execute closes the previously active window. This method also allows you to execute macros from a number of different templates.]
:MenuMode
Syntax: MenuMode
Activates menu mode. Equivalent to pressing Alt or F10.
:Mid$()
Syntax: Num = Mid$(A$, n, [m])
Returns m characters from A$, starting at character n. If m is not supplied, the rest of the string is returned.
Funtion Return value
------------ --------------------
Print Mid$("12345678", 2, 3) 234
:MkDir
Syntax: MkDir Name$
Creates the directory specified by DirName$.
:MoveText
Syntax: MoveText
Moves text. Equivalent to pressing F2.
To use this statement:
1 Make a selection.
2 Run MoveText.
3 Position the insertion point where you want to move the text.
4 Run OK (press Enter).
:MsgBox (See MsgBox() for Hacker's Guide notes)
Syntax: MsgBox Message$, Title$, Type
Creates a message box displaying Message$.
Title$ is the title of the message box. If it is not supplied, "Microsoft Word" is the title of the message box. Type determines the symbol and buttons displayed in the box. It is the sum of a value from the following groups:
Type arg Displays
-------------- --------------
Button:
0 OK button (default)
1 OK and Cancel buttons
2 Abort, Retry, Ignore buttons
3 Yes, No, Cancel buttons
4 Yes and No buttons
5 Retry and Cancel buttons
Icons:
0 No icon (default)
16 Hand icon
32 Question icon
48 Exclamation icon
64 Asterisk icon
Button action:
0 First button is the default (default)
256 Second button is the default
512 Third button is the default
If Type is negative, then the message is displayed in the status bar and Type must be the sum of -1 (display the message permanently), -2 (display until a mouse or key event occurs), or -8 (use the entire status bar width).
[HACKER'S GUIDE ALERT: > Maximum Message$ and Title$ length is 255 characters. The "Attention icon" is a big exclamation point. The "Information icon" is a lower-case "i" with a circle around it. Quite some time ago - when I was just learning WordBASIC - I tried negative values for Type. They didn't work for me back then. It's easier to use Print anyway. Note that the cancel button here is fundamentally different from the one in a Dialog Box. If the user clicks CANCEL in a MsgBox, no OnError condition is raised. Rather, you have to test the returned value of MsgBox() to see which button was clicked.]
:Name
Syntax: Name OldName$ As NewName$
Renames a file.
STATMENT: Name "COGS.DOC" As "COGS88.DOC"
EFFECT: Renames the file COGS.DOC as COGS88.DOC
STATEMENT Name "COGS.DOC" As "COGS.RTF"
EFFECT: Renames the file COGS.DOC as COGS.RTF (does not change the file format)
:Next
See "For"
:NextCell
Syntax: NextCell
Moves the selection to the beginning of the next cell in a table.
[HACKER'S GUIDE ALERT: > NextCell not only moves the cursor to the next cell, it selects the contents of the next cell as well. It's a bit strange because it doesn't work like all the other functions -LineDown, CharRight, that sort of stuff. And there's no CellDown or CellUp.
Anyway, I needed to test for an empty cell. Tried all sorts of things, but this finally worked (!).......]
:NextCell()
Syntax: Log = NextCell()
Moves to the next cell. Returns 0 (zero) if there is no next cell.
:NextField
Syntax: NextField
Moves the selection to the next field result. Skips over marker fields, such as Index Entry fields.
:NextField()
Syntax: Log = NextField()
Moves to the next field. Returns 0 (zero) if there is no next field.
:NextObject
Syntax: NextObject
Selects the next object in print preview or moves to the next text area in page view.
:NextObject()
Syntax: Log = NextObject()
Moves to the next positioned object. Returns 0 (zero) if there is no next object.
:NextPage
Syntax: NextPage
Moves the insertion point to the beginning of the next page in page view.
:NextPage()
Syntax: Log = NextPage()
Moves the insertion point to the beginning of the next page. Returns 0 (zero) if there is no next page.
:NextTab()
Syntax: Num = NextTab(Pos)
Returns the position of the next tab stop to the right of Pos. Pos is a floating-point number given in points. If more than one paragraph is selected and the tabs do not all match, -1 is returned.
:NextWindow
Syntax: NextWindow
Moves the selection to the next document window.
:NormalStyle
Syntax: NormalStyle
Formats the selection in Normal paragraph format.
:NormalStyle()
Syntax: Num = NormalStyle()
Returns 1 if all of the selection has the Normal style, 0 (zero) if none of the selection has the Normal style, and -1 if part of the selection has the Normal style.
:OK
Syntax: OK
Terminates a copy or move operation and performs its action.
:OKButton and CancelButton
Syntax: OKButton x, y, dx, dy
Syntax: CancelButton x, y, dx, dy
If you choose the OK button, the macro continues. If you choose the Cancel button, an error is generated. This error can be trapped with On Error (see Macros: Introduction).
:On Error
Syntax: On Error Goto Label
Syntax: On Error Resume Next
Syntax: On Error Goto 0
The On Error control structure allows the programmer to "trap" an error so that the program can perform its own error handling. For more information on On Error, see Macros: Introduction
:OnTime
Syntax: OnTime When$, Name$, [Tolerance]
Executes the macro specified by Name$ at the time specified by When$. When$ is a text representation of the time for execution in a 24-hour format. When$ can also include a date string that precedes the time string. If the date is not specified, the macro is run at the first occurence of the specified time. The macro is executed the next time Word is idle after the specified When$. Word does not run the macro if more than Tolerance seconds have elapsed since When$, and the macro has not yet run. If Tolerance is 0 (zero), or not supplied, Word will always run the macro, regardless of how long it is before Word is idle and can run the macro.
[HACKER'S GUIDE ALERT: > This section of the Tech Ref desperately needs re-writing.
When$ can be in one of two formats, either "12:34" or "12:34:56". You must have the colon in the right place. You must have precisely two digits for the hour, two for the minute, and (if you use seconds), two for the second. It's all on a military-style 24-hour clock. So, 8:15 a.m. is "08:15", and 8:15 p.m. is "20:15"; two minutes past midnight is "00:02". WARNING: there was an autobackup macro circulating at one point that failed to "flop over" from 23:59 to 00:00 - it went to 24:00. (Guess that's what you get for running autobackups between midnight and 1 am!) o repeat the Tech Ref, for emphasis - you can have just ONE OnTime macro running. If you start another OnTime macro, the first one is clobbered completely, without any warning. When$ and Name$ are limited to 255 characters.]
:Open
Syntax: Open Name$ For Mode$ As [#]StreamNumber
Opens the file or device specified by Name$. The Name$ can be a device such as Com1 or Lpt1, and must be enclosed in quotation marks. Do not include the colon following the device name. [HACKER'S GUIDE ALERT: > Name$ is limited to a maximum of 255 characters. An example:
Open "lpt1" for Output As #1
Print #1, "Foobar"]
:OpenUpPara
Syntax: OpenUpPara
Adds one line of space before the current paragraph.
:OptionGroup and OptionButton
Syntax: OptionGroup .Field
Syntax: OptionButton x, y, dx, dy, Text$
OptionGroup begins the definition of a series of related option buttons. Within the group only one button may be active (on) at a time. The .Field argument is set to a value between 0 (zero) and n, which represents the value of the currently active button.
OptionGroup .brk
OptionButton 63, 36, 24, 12, "&PageBreak"
OptionButton 63, 47, 24, 12, "&LineBreak".
(HACKER'S GUIDE ALERT:>.Text$ field is req'd even if you're only using the button to set up a fancy text box. A fancy TextBox is one that has an OptionButton right in front of it, so the user chooses the option, and specifies text in the same dialog box.)
:OtherPane
Syntax: OtherPane
Moves the selection to the other pane of the current window.
:OutlineCollapse
Syntax: OutlineCollapse
Collapses the lowest level of subtext levels under the selected heading.
:OutlineDemote
Syntax: OutlineDemote
Increases the heading level of the selection by one.
:OutlineExpand
Syntax: OutlineExpand
Expands the lowest level of subtext under the selected heading.
:OutlineLevel()
Syntax: Num = OutlineLevel()
Returns the heading level of the specified paragraph. Returns 0 (zero) if the specified paragraph doesn't have a defined level (body text, for example).
:OutlineMoveDown
Syntax: OutlineMoveDown
Moves the selection below the next visible heading.
:OutlineMoveUp
Syntax: OutlineMoveUp
Moves the selection above the next visible heading.
:OutlinePromote
Syntax: OutlinePromote
Decreases the heading level of the selection by one.
:OutlineShowFirstLine
Syntax: OutlineShowFirstLine [On]
Toggles the state. Changes the view of non─heading level text between all text shown and only first line of text shown.
:Overtype
Syntax: Overtype [On]
Without the argument, toggles overtyping mode. If On is nonzero, overtype mode is activated and OVR is displayed in the status bar. If On is 0 (zero), overtype mode is deactivated.
:Overtype()
Syntax: Log = Overtype()
Returns -1 if overtype mode is on, 0 (zero) if overtype mode is off.
:PageDown
Syntax: PageDown [Repeat], [Select]
Moves the selection down by Repeat screens. If the Repeat argument is omitted, 1 is assumed. If Select is nonzero, the selection is extended down by Repeat screens. Equivalent to the PgDn key. If Select is 0 (zero) or omitted, the selection is not extended.
Statement Effect
---------------- ----------
PageDown 1, 1 Extends the selection down one screen from the insertion point.
:PageDown()
Syntax: Log = PageDown ([Repeat], [Select])
Moves the selection down by Repeat pages. Returns -1 if operation was successful, returns 0 (zero) if not.
:PageUp
Syntax: PageUp [Repeat], [Select]
Moves the selection up by Repeat screens. If the Repeat argument is omitted, 1 is assumed. If Select is nonzero, the selection is extended up by Repeat screens. Equivalent to the PgUp key. If Select is 0 (zero) or omitted, the selection is not extended.
Statement Effect
---------------- ---------
PageUp 20 Moves the selection point up 20 screens from the insertion point, but does not extend the selection
:PageUp()
Syntax: Log = PageUp ([Repeat], [Select])
Moves the selection up by Repeat pages. Returns -1 if operation was successful, returns 0 (zero) if not.
:ParaDown
Syntax: ParaDown [Repeat], [Select]
Moves the selection down by Repeat paragraphs. If Repeat is omitted, 1 is assumed. If Select is nonzero, the selection is extended down by Repeat paragraphs.
:ParaDown()
Syntax: Log = ParaDown ([Repeat], [Select])
Moves the selection down by Repeat paragraphs. Returns 0 (zero) if the action cannot be performed. For example, the function returns 0 if the insertion point is at the end of the document.
:ParaUp
Syntax: ParaUp [Repeat], [Select]
Moves the selection up by Repeat paragraphs, If Repeat is omitted, 1 is assumed. If Select is nonzero, the selection is extended up by Repeat paragraphs.
:ParaUp()
Syntax: Log = ParaUp([Repeat], [Select])
Moves the selection up by Repeat paragraphs. Returns 0 (zero) if the action cannot be performed. For example, the function returns 0 if the insertion point is at the beginning of the document.
:PauseRecorder
Syntax: PauseRecorder
Stops macro recording until PauseRecorder is executed again.
:PrevCell
Syntax: PrevCell
Moves the selection to the previous cell.
:PrevCell()
Syntax: Log = PrevCell()
Moves to the previous cell. Returns 0 (zero) when the selection is in the first cell.
:PrevField
Syntax: PrevField
Moves the selection to the previous field.
:PrevField()
Syntax: Log = PrevField()
Moves to the previous field. Returns 0 (zero) when the selection is in the first field.
:PrevObject
Syntax: PrevObject
Selects the previous object in print preview or moves to the previous text area in page view.
:PrevObject()
Syntax: Log = PrevObject()
Moves to the previous object. Returns 0 (zero) when the selection is at the first object or text area.
:PrevPage
Syntax: PrevPage
In page view, moves the insertion point to the beginning of the previous actual page.
:PrevPage()
Syntax: Log = PrevPage()
Moves to the previous page. Returns 0 (zero) when the selection is at the first actual page.
:PrevTab()
Syntax: Log = PrevTab(Pos)
Returns the position of the next tab to the left of Pos. Pos is a floating-point number given in points. If more than one paragraph is selected and the tabs do not all match, -1 is returned.
:PrevWindow
Syntax: PrevWindow
Activates the previously active window.
:Print
Syntax: Print [[#]StreamNumber], Expression
Writes Expression to the file specified by StreamNumber. With no StreamNumber specified, output goes to the status bar. [HACKER'S GUIDE ALERT: > ]Expression is limited to a total of 255 characters. This Print statement works like most other BASIC print statements, e.g., there is a carriage return appended to the end of each print Expression unless the Expression ends with a semicolon.
:Read
Syntax: Read [#]StreamNumber, VariableName(s)
Similar to the Input statement, but removes quotation marks for strings. This statement is used with the Write statement.
:RecordNextCommand
Syntax: RecordNextCommand
Records the next command at the insertion point in the current macro window.
:Redim
Syntax: [Shared] Var [(Size)] [, Var [(Size)...]
Realocates storage space for a previously defined variable array. May be used to enlarge an array, but the contents will be lost. Redim can also be employed to resue a previously defined dialog record.
[HACKER'S GUIDE ALERT: > The only way that's been found to "pass" an array to a Function or subroutine uses Redim. Uh.... judiciously, shall we say? Try this:
Dim Shared Array(0)
Sub Main
Redim SharedArray(500)
......
B=SumArray(500)
......
End Sub
Function SumArray(MaxArrayIndex)
For i=0 to MaxArrayIndex
N=N + SharedArray(i)
Next i
SumArray=N
EndFunction ]
:Rem
Syntax: REM Remarks
Syntax: 'Remarks
Inserts explanatory text into the macro. You can use an apostrophe (') instead of a REM statement. If a REM statement follows other statements on a line, it must be separated from those statements by a colon (:). A colon is not required before a remark introduced by an apostrophe.
:RenameMenu
Syntax: RenameMenu MenuNumber, NewText$
Renames the top level menu of Menu Number to New Text$. MenuNumber represents the name of a menu. NewText$ replaces the menu name. An ampersand (&) preceding a character makes it the keyboard equivalent to selecting from the menu. For example, "&Programs" becomes Programs when this statement is executed.
STATEMENT: RenameMenu 5, "&Other Tasks"
EFFECT: Changes Utilities to Other Tasks
[HACKER'S GUIDE ALERT: > NewText$ is limited to 255 characters. If you rename a menu with a long name, the menu bar will jump to two (maybe more?) lines. But, no, there is no way to add another - ninth - menu. All you get is numbers 0 thru 7.]
The MenuNumber argument values are:
MenuNumber Menu
--------------------- -----------
0 File
1 Edit
2 View
3 Insert
4 Format
5 Utilities
6 Macro
7 Window
:Repeat
Syntax: Repeat
Repeats the last command.
:RepeatSearch
Syntax: RepeatSearch
Repeats the most recent search.
:ResetChar
Syntax: ResetChar
Removes manual character formatting from the selected text. Manual character formatting is formatting that is not applied as a style. For example, you manually format a word or phrase in a paragraph as bold text if the paragraph style is normal text. The text is left with the character formatting of the current style.
:ResetChar()
Syntax: Num = ResetChar()
Returns 1 if the selected text contains no manual character formatting. Returns 0 (zero) if any manual character formatting is present.
:ResetFootnoteContNotice
Syntax: ResetFootnoteContNotice
Resets the footnote continuation notice to the default value.
:ResetFootnoteContSep
Syntax: ResetFootnoteContSep
Resets the footnote continuation separator to the default value.
:ResetFootnoteSep
Syntax: ResetFootnoteSep
Resets the footnote separator to the default value.
:ResetPara
Syntax: ResetPara
Removes manual paragraph formatting from the selected text. The text is left with the paragraph formatting of the current style.
:ResetPara()
Syntax: Num = ResetPara()
Returns 1 if the selected text contains no manual paragraph formatting. Returns 0 (zero) if any manual paragraph formatting is present.
:Right$()
Syntax: A$ = Right$(A$, n)
Returns the rightmost n characters of A$.
Function Return value
---------------- ----------------------
A$ = "Legal File List"
Print Right$(A$,4) "List"
A$ = "Legal File List"
Print Right$(A$,9) "File List"
:RightPara
Syntax: RightPara
Right aligns the selected paragraphs.
:RightPara()
Syntax: Num = RightPara()
Returns 0 (zero) if none of the selected paragraphs are right aligned, 1 if all of the selected paragraphs are right aligned, or -1 if more than one kind of paragraph alignment is used.
:RmDir
Syntax: RmDir Name$
Removes the specified directory or subdirectory. Files must first be removed from the subdirectory for this statement to work.
:Rnd()
Syntax: Num = Rnd([Expression])
Returns a random fractional value between 0 (zero) and 1. The Expression is not used by WordBASIC, but is provided for compatibility with other forms of BASIC.
:RulerMode
Syntax: RulerMode
Switches to ruler mode.
:SaveTemplate
Syntax: SaveTemplate
Saves the document's template. If the document has no template, saves Normal.dot.
:Seek
Syntax: Seek [#]StreamNumber, Count
Positions file pointer at character Count in the file attached to stream StreamNumber.
:Seek()
Syntax: Num = Seek([#]StreamNumber)
Returns the current file pointer for the specified StreamNumber.
:Select Case...Case Else End Select
Syntax: Select Case Expression
Case CaseExpression
Statement(s)
[Case Else
Statement(s)]
End Select
The expression is compared with all the values given in each CaseExpression until a match is found. If a match is found, the statement(s) following the CaseExpression are executed. If there is no match and there is a Case Else, those statement(s) are executed.
[HACKER'S GUIDE ALERT: > Ever wonder why your macros pop up a box that say "Select Without End Select"? It's because of a "design feature" of the Select statement. WinWord has to "execute" an End Select prior to finishing a macro - otherwise the bogus "Select Without End Select" box pops up. For example, this will give you a bogus message:
Select Case N
Case 1
Goto Bye
Case Else
End Select
DoStuff
Bye:
End Sub
But if you just change it a little bit, you won't get that stupid message:
Select Case N
Case 1
Flag=-1
Case Else
End Select
If Flag Goto Bye
DoStuff
Bye:
End Sub ]
:Selection$()
Syntax: A$ = Selection$()
Returns the plain, unformatted text of the selection. The maximum limit on the selection is 32,000 characters or until memory runs out. If the selection is too large, Selection$() is filled with as much of the selection as will fit, and an error is generated. If the selection is an insertion point, the character following the insertion point is returned.
:SelectTable
Syntax: SelectTable
Selects the table containing the insertion point.
:SelType
Syntax: SelType Type
Changes the selection highlighting to Type. Type refers to one of the following:
Type Selection Type
------- ------------------------
0 Hidden text
1 Insertion point
2 Selection
4 Dotted selection or insertion point (whatever is current)
5 Dotted insertion point
6 Dotted selection
:SelType()
Syntax: Num = SelType()
Returns the type of the selection highlighting.
Selection Function returns
--------------- --------------------------
Hidden text 0
Insertion point 1
Selection 2
Dotted insertion
point or selection
(whatever is current) 4
Dotted insertion point 5
Dotted selection 6
:SendKeys
Syntax: SendKeys Keys$, Wait
Sends the keys specified to the active application, just as if they were typed at the keyboard. If Word is not the active application and Wait is -1, Word waits for all keys to be processed before proceeding. Keys$ is represented by one or more characters, such as a for the character a, {Enter} for the Enter key, and {33} for PgUp. To specify characters that aren't displayed when you press the key, use the codes shown in the following table.
Key Code
------ ----------------
Backspace {backspace} or {bs} or {bksp}
Break {break}
CapsLock {capslock}
Clear {clear}
Del {delete} or {del}
Down {down}
End {end}
Enter {enter}
Esc {escape} or {esc}
Help {help}
Home {home}
Ins {insert}
Left {left}
NumLock {numlock}
PgDn {pgdn}
PgUp {pgup}
PrtSc {prtsc}
Right {right}
Tab {tab}
Up {up}
FKey: F# {F#} (For example, F12 is {F12})
The plus sign (+), the percent sign (%), and the caret (^) have special meanings, described below.
For example, %{enter} sends the code for Alt+Enter. The code +(eb) specifies EB.
To repeat a key sequence, use the syntax {key number}. For example, {pgdn 20} means press the PgDn key 20 times. Remember to put a space between the key and the number.
[HACKER'S GUIDE ALERT: > Keys$ is limited to 255 characters. SendKeys is nothing but a kludge. But sometimes it's a necessary kludge. In particular, it's an approach of last resort for situations where WinWord support is severely lacking - FilePrinterSetup being a good example. SendKeys will not work (or at least it won't work the way you expect) when you are editing a macro, using the STEP button. The keys you want to send may be surrounded by (), e.g., these are the same:
SendKeys "help"
SendKeys("help")
If you want to send a space, use brackets surrounding a space, e.g.
SendKeys { }
will send a space (or simulate pressing the space bar, if you prefer). To send a plus key, try
SendKeys {Alt-043}
where Alt-043 is formed by turning ON NumLock, holding down Alt, typing 043 on the number pad, then releasing Alt.]
:SentLeft
Syntax: SentLeft [Repeat], [Select]
Moves the insertion point left by Repeat number of sentences. If Repeat is omitted, 1 is assumed. If Select is nonzero, the selection is extended up by Repeat sentences.
:SentLeft()
Syntax: Log = SentLeft([Repeat], [Select])
Moves the insertion point left by Repeat number of sentences. If Repeat is omitted, 1 is assumed. If Select is nonzero, the selection is extended up by repeat sentences. Returns 0 (zero) if the action cannot be performed. For example, the function returns 0 (zero) if the insertion point is at the beginning of the document.
:SentRight
Syntax: SentRight[Repeat], [Select]
Moves the insertion point right by Repeat number of sentences. If Repeat is omitted, 1 is assumed. If Select is nonzero, the selection is extended up by Repeat sentences.
:SentRight()
Syntax: Log = SentRight([Repeat], [Select])
Moves the insertion point right by Repeat number of sentences. If Repeat is omitted, 1 is assumed. If Select is nonzero, the selection is extended up by repeat sentences. Returns 0 (zero) if the action cannot be performed. For example, the function returns 0 (zero) if the insertion point is at the beginning of the document.
:SetDirty
Syntax: SetDirty [Dirty]
Makes Word recognize the current document as "dirty," or a changed document. If Dirty is omitted or 1, the document is made dirty. If 0 (zero), it makes the document not dirty.
:SetEndOfBookmark
Syntax: SetEndOfBookmark Bookmark1$, [Bookmark2$]
Sets Bookmark2$ to the end point of Bookmark1$. If Bookmark2$ is not supplied, Bookmark1$ is set to its own end.
:SetGlossary
Syntax: SetGlossary Name$, Text$, [Context]
Defines a glossary entry called Name$ containing the text Text$. Context is 0 (zero) for global, 1 for document template.
The variables may be set prior to calling the statement as shown in the second example. Using variables makes it easier to change the definition if necessary.
STATEMENT: SetGlossary "Disclaim", "No warranty, either express or implied, is made by Trey Research." ,1
EFFECT: Defines the glossary entry called Disclaim, with the template context,
containing the specified text.
STATEMENT:
Text$ = "No warranty, either express orimplied, is made by Trey Research."
SetGlossary "Disclaim", Text$, 1
EFFECT: Defines the same glossary entry as in the first example, but uses the variable Text$.
[HACKER'S GUIDE ALERT: > Glossary names are limited to a maximum of 255 characters. You can use SetGlossary and GetGlossary to store variable values.
Sub SetParam(Name$,Value$)
SetGlossary Name$, Value$, 0
End Sub
Function GetParam$(Name$)
GetPara$=GetGlossary$(Name$)
End Function
The problem with this approach is that it sets NORMAL.DOT "dirty", i.e., IsDirty will be on, and the user will be prompted to save global glossary and command changes next time they exit WinWord. However, if you keep track of whether NORMAL.DOT was dirty before you started storing values in the glossary, use the tip listed in the Hacker's Guide on Page 209 (IsDirty), and use SetDirty properly, there's no reason why you can't take advantage of this approach. On the other hand, SetProfileString may be a cleaner way of doing what you want to do.]
:SetProfileString
Syntax: SetProfileString [App$], Key$, Value$
Sets a value in the current WIN.INI.
App$ is the name of the Microsoft Windows application. If the application is not specified, the string [Microsoft Word] is used.
Sets Bookmark2$ to the starting point of Bookmark1$. If Bookmark2$ is not given, Bookmark1$ is set to its own start.
:Sgn()
Syntax: Num = Sgn(n)
Returns the sign of n. Returns 1 for a positive number, -1 for a negative number, or 0 for zero.
Function Return value
-------------- ----------------------
Sgn(4) 1
Sgn(-14) -1
Sgn(0) 0
:Shell
Syntax: Shell App$, [WindowStyle]
Starts another program under Microsoft Windows. App$ uses the same format as the File Run command in the Windows MS-DOS Executive, including any switches or arguments that the program accepts. If App$ is the name of a file with an extension specific to an installed application (.DOC for a Word document, for example), the statement starts the application and loads that file.WindowStyle specifies how the window containing the program should appear, as follows:
Mode Window type
--------- ----------------------
0 Minimized window; default
1 Normal window
2 Minimized window (for Microsoft Excel compatibility)
3 Maximized window
4 Deactivated window
STATEMENT: Shell "EXCEL.EXE", 2
EFFECT: Starts Microsoft Excel and minimizes the window
STATEMENT: Shell "TRENDS.XLC", 1
EFFECT: Starts Microsoft Excel and loads the document TRENDS.XLC in a normal window
STATEMENT: Shell "NOTEPAD.EXE TORT.TXT"
EFFECT: Starts Notepad and loads the document TORT.TXT
[HACKER'S GUIDE ALERT: > App$ is limited to 255 characters. To shell out to DOS, try
Shell "command.com /c"]
:ShowAll
Syntax: ShowAll [On]
Without the argument, toggles ShowAll option of the View Preference command. If On is nonzero, shows all invisible objects such as hidden text, tabs, spaces, paragraph marks, and so on. If On is 0 (zero), turns off ShowAll option.
:ShowAllHeadings
Syntax: ShowAllHeadings
Shows all text in outline view.
:ShowHeading1
Syntax: ShowHeading1
Shows all Level 1 headings and hides subordinate headings.
:ShowHeading2
Syntax: ShowHeading2
Shows all Level 2 headings and hides subordinate headings.
:ShowHeading3
Syntax: ShowHeading3
Shows all Level 3 headings and hides subordinate headings.
:ShowHeading4
Syntax: ShowHeading4
Shows all Level 4 headings and hides subordinate headings.
:ShowHeading5
Syntax: ShowHeading5
Shows all Level 5 headings and hides subordinate headings.
:ShowHeading6
Syntax: ShowHeading6
Shows all Level 6 headings and hides subordinate headings.
:ShowHeading7
Syntax: ShowHeading7
Shows all Level 7 headings and hides subordinate headings.
:ShowHeading8
Syntax: ShowHeading8
Shows all Level 8 headings and hides subordinate headings.
:ShowHeading9
Syntax: ShowHeading9
Shows all Level 9 headings and hides subordinate headings.
:ShowVars
Syntax: ShowVars
Displays the list of variables (and their values) currently in use. This statement is useful for debugging macros.
:ShrinkFont
Syntax: ShrinkFont
Decreases the size of the selected font. Can be used either on the selection or at the insertion point.
:ShrinkSelection
Syntax: ShrinkSelection
Shrinks the selection to the next smallest unit (word, sentence, paragraph, etc.).
:SmallCaps
Syntax: SmallCaps [On]
Without the argument, toggles small caps for the entire selection. If On is nonzero, makes the entire selection small caps. If On is 0 (zero), removes small caps from the entire selection.
:SmallCaps()
Syntax: Num = SmallCaps()
Returns 0 (zero) if none of the selection is small caps, 1 if all of the selection is small caps, or -1 if part of the selection is small caps.
:SpacePara1
Syntax: SpacePara1
Formats the selected paragraphs with single spacing.
:SpacePara1()
Syntax: Num = SpacePara1()
Returns 0 (zero) if none of the selected paragraphs are single-spaced, 1 if all of the selected paragraphs are single─spaced, or -1 if more than one kind of paragraph spacing is used.
:SpacePara2
Syntax: SpacePara2
Formats the selected paragraphs with double spacing.
:SpacePara2()
Syntax: Num = SpacePara2()
Returns 0 (zero) if none of the selected paragraphs are double-spaced, 1 if all of the selected paragraphs are double-spaced, or -1 if more than one kind of paragraph spacing is used.
:SpacePara15
Syntax: SpacePara15
Formats the selected paragraphs with one-and-one-half line spacing.
:SpacePara15()
Syntax: Num = SpacePara15()
Returns 0 (zero) if none of the selected paragraphs are one-and-one-half spaced, 1 if all of the selected paragraphs are one-and-one─half spaced, or -1 if more than one kind of paragraph spacing is used.
:Spike
Syntax: Spike
Deletes the selection after copying it to the special glossary called the Spike. [HACKER'S GUIDE ALERT: > WinWord adds a paragraph mark to the end of each selection that you place on the Spike.]
:StartOfColumn
Syntax: StartOfColumn [Select]
Moves insertion point to topmost position in the currently selected table column.
:StartOfDocument
Syntax: StartOfDocument [Select]
Moves the selection to the beginning of the document. If Select is nonzero, extends the selection.
:StartOfLine
Syntax: StartOfLine [Select]
Moves the selection to the beginning of the line. If Select is nonzero, extends the selection.
:StartOfRow
Syntax: StartOfRow [Select]
Moves insertion point to the leftmost position in the currently selected table row.
:StartOfWindow
Syntax: StartOfWindow [Select]
Moves the insertion point to the top left corner of the window. If Select is nonzero, extends the selection.
:StepMacro
Syntax: StepMacro
[HACKER'S GUIDE ALERT: > Another undocumented Winword command. Seems to work like the macro editor function.]
:StepMacroSUBs
Syntax: StepMacroSUBs
[HACKER'S GUIDE ALERT: > Yet another undocumented Winword command. Also seems to work like the macro editor function.]
:Stop
Syntax: Stop
Stops a running macro and displays a message that the macro was interrupted.
:Str$()
Syntax: A$ = Str$(n)
Returns the string representation of value n. Positive numbers have a leading space character.
:String$()
Syntax: A$ = String$(n, A$)
Returns the first character in A$ repeated n times. Replacing A$ with the number m representing the ASCII value of A$ returns the character with ANSI code m
Returns the name of the style defined in the given context (global or document template). Count may be in the range from 1 to CountStyle(Context).
If Count is 0 (zero), the name of the current style is returned; otherwise, the name is taken from the list in the given context. Context is 0 for global, 1 for document template.
:Sub/End Sub
Syntax: Statement(s) Sub Name [ParameterList]
End Sub
Defines a subroutine. For more information on subroutines, see Macros: Introduction.
:SubScript
Syntax: SubScript [On]
Without the argument, toggles subscript for the entire selection. If On is nonzero, makes the entire selection subscript. If On is 0 (zero), removes subscript from the entire selection.
:SubScript()
Syntax: Num = SubScript()
Returns 0 (zero) if none of the selection is subscript, 1 if all of the selection is subscript, or -1 if part of the selection is subscript or superscript.
:Super
Syntax: Super Statement
Directs Word to run the named macro at the next context level. For macros with the same name, Word runs the template macro before a global macro and a global macro before a built-in command. Super overrides this order. If, for example, you have a macro named FilePrint, a Super FilePrint statement runs the built in command. [HACKER'S GUIDE ALERT: > That last sentence should read:
"If, for example, you have a global macro named FilePrint, a Super FilePrint statement runs the built-in command." (The original wording is incorrect if you have both a global and a template macro named FilePrint.) There was quite a discussion of Super in a recent PC Magazine article. The article claimed that Super did nothing. Horseradish. The manual is right, PC Mag is wrong. (That's mighty unusual, in my experience!)]
:SuperScript
Syntax: SuperScript [On]
Without the argument, toggles superscript for the entire selection. If On is nonzero, makes the entire selection superscript. If On is 0 (zero), removes superscript from the entire selection.
:SuperScript()
Syntax: Num = SuperScript()
Returns 0 (zero) if none of the selection is superscript, 1 if all of the selection is superscript, or -1 if part of the selection is superscript or subscript.
:TabLeader$()
Syntax: A$ = TabLeader$(Pos)
Returns the leader character of the tab at Pos. If more than one paragraph is selected and all the tabs don't match, an empty string is returned.
The leader characters returned are blank space, period, hyphen, and underscore.
:TabType()
Syntax: Num = TabType(Pos)
Returns the type of tab at the given position Pos. If more than one paragraph is selected and all the tabs don't match, -1 is returned. If the tabs match, the type is returned as follows:
Returned Tab type is
-------------- -------------------
0 Left-aligned
1 Centered
2 Right-aligned
3 Decimal
:Text
Syntax: Text x, y, dx, dy, Text$
Text 7, 10, 21, 9, "&Text:"
Creates a box of static text. Text does not have a result. [HACKER'S GUIDE ALERT: > Text$ is limited to 255 characters. If you want an ampersand to show up you must double it. I.e., &A will display as A But &&A will display as &A]
:TextBox
Syntax: TextBox x, y, dx, dy, .Field
TextBox 32,8,65,12, .TB$
Creates an edit control. [HACKER'S GUIDE ALERT:> First, make that a .Field$ It's always a string variable. And it cannot be dimensioned. For example,
TextBox 8, 50, 400, 12, .MyArray$(3)
will bomb out. Why? Lousy design decision. You'll find some macros (including several of mine) with line after line after line assigning values to undimensioned variables just to handle this dumb requirement. The Tech Ref is ridiculously confusing about TextBox. All it does is display .Field$, let the user modify it, and return the modified results back to your macro.
In WinWord 1.0, .Field$ was "poured" into the defined area, starting in the upper left corner. But in version 1.1, 1.10a, etc., .Field$ is "poured" into the defined area, centered from top to bottom. Yecch. Another "improvement" in 1.1: Newline and Paragraph marks do not force line feeds any more. Really screwed up one of the early versions of Enveloper with this design decision........ The user cannot type in a Shift+Enter - or any other paragraph mark - so you cannot use TextBox for a lot of things. I don't think Alt-0027 will come through either. Check on other Alt-codes to see if they will work before you use TextBox in any situation that requires anything beyond ANSI Windows characters. It's really too bad, too, because TextBox - if it were implemented properly - could be a very powerful command!
.Field$ is limited to 255 characters. But that usually doesn't matter much, because the number of characters in .Field$ "count" against the dialog box max of 512. That can give you runtime errors - Dialog Box Description Too Complex - if you aren't careful. If you want an ampersand to show up you must double it. I.e., &A will display as A But &&A will display as &A
Generally you will want a dialog box's "cursor" to go to a TextBox first. If you make a TextBox the first item in the UserDialog, the "cursor" will go there, and highlight any default text you may have inserted.]
:Time$()
Syntax: A$ = Time$()
Returns the current time in the default format.
:ToggleFieldDisplay
Syntax: ToggleFieldDisplay
Toggles the display between field codes and field results.
:UCase$()
Syntax: A$ = UCase$(A$)
Returns A$ converted to uppercase.
:TraceMacro
[HACKER'S GUIDE ALERT: > Another undocumented WinWord command.]
:Underline
Syntax: Underline [On]
Without the argument, toggles underlining for the entire selection. If On is nonzero, makes the entire selection underlined. If On is 0 (zero), removes underlining from the entire selection.
:Underline()
Syntax: Num = Underline()
Returns 0 (zero) if none of the selection is underlined, 1 if all of the selection is underlined, or -1 if part of the selection is underlined or more than one kind of underlining is used.
:UnHang
Syntax: UnHang
Reduces the amount of indent in a hanging indent.
:UnIndent
Syntax: UnIndent
Removes the indent from the selected paragraphs. The first paragraph is aligned with the previous tab stop.
:UnLinkFields
Syntax: UnLinkFields
Converts the selected fields to plain text and uses the last result.
:UnLockFields
Syntax: UnLockFields
Unlocks fields in the current selection for updating. [HACKER'S GUIDE ALERT: > The Tech Ref has a mighty cryptic description of UnLockFields. Here's an example that may help. If you insert a date field into your document, format and update it, you'll get the date. Unfortunately, the next time you update fields for that document, the date will change. To keep the date field from changing - in fact, to keep any field from being updated during the usual update fields operation - just stick your cursor anywhere inside the field, then issue UnLockFields. (Equivalently, reformed WurdPerfect addicts can push Ctrl-Shift-F9.) Once a field is "unlocked" it won't be updated any more.]
:UnSpike
Syntax: UnSpike
Empties the Spike glossary and inserts all contents into the document at the
selection.
:UpdateFields
Syntax: UpdateFields
Updates the fields in the selection.
:UpdateSource
Syntax: UpdateSource
Sends changes in linked Word documents back to their source.
:UtilCalculate
Syntax: UtilCalculate
Equivalent to the Calculate command on the Utilities menu. The selection is evaluated as a mathematical expression. The result of the evaluation is placed on the Clipboard.
:UtilCalculate()
Syntax: Num = UtilCalculate([Expression$])
Evaluates Expression. With the argument, this function is equivalent to the = field. Values in Expression can be table cell references. For more information on the = field, see Fields. Without an expression, performs the same operation as the UtilCalculate statement, but returns the result rather than placing it on the Clipboard. [HACKER'S GUIDE ALERT: > Go to great lengths to make sure there are no paragraph marks in your selection, prior to running UtilCalculate. Paragraph marks drive UtilCalculate crazy; a paragraph mark in front of a negative number may hang your system.]
:UtilCompareVersions
Syntax: UtilCompareVersions Name$
Equivalent to the Compare Versions command on the Utilities menu. Compares the current document with the document specified by Name$.
Equivalent to the Customize command on the Utilities menu. The following table summarizes the arguments. Some arguments take measurements in points or numbers. Other arguments correspond to check boxes.
Argument Description
---------------- ------------------
AutoSave Specifies automatic save frequency; can be 0 (Never), 1 (Low), 2 (Medium), or 3 (High)
Units Units of measure used in the Ruler; can be 0 (inches), 1 (centimeters), 2 (points), or 3 (picas)
Pagination Corresponds to Background Pagination checkbox
SummaryPrompt Corresponds to Prompt For Summary Info check box
ReplaceSelection Corresponds to Typing Replaces Selection check box
Name$ Your name
Initials$ Your initials
ButtonFieldClicks 1 if one mouse click activates a MACROBUTTON or GOTOBUTTON field; 2 if two clicks are required
Fills the string array FillArray$ with all available spellings for a word. If Word$ is supplied, that word is used. If it is not supplied, Word uses the word closest to the insertion point. The spellings for each definition are appended in the order they appear in the spelling checker.
Fills the string array FillArray$ with all available spellings of a word. If Word$ is supplied, that word is used. If it is not supplied, Word uses the word closest to the insertion point. The spellings for each definition are appended in the order they appear in the spelling checker. Returns 0 (zero) if the word is spelled correctly.
:UtilGetSynonyms
Syntax: UtilGetSynonyms FillArray$(), [Word$]
Fills the string array FillArray$ with all available synonyms for Word$. If Word$ is not supplied, the word nearest the selection is used.
Fills the string array FillArray$ with all available synonyms for Word$. If Word$ is not supplied, the word nearest the selection is used. Returns 0 (zero) if there are no synonyms available and returns -1 if one or more synonyms are available.
Equivalent to the Hyphenate command on the Utilities Menu. The following table summarizes the arguments. The arguments correspond to check boxes.
Argument Description
--------------- -------------------
HyphenateCaps Corresponds to Hyphenate Caps check box
Confirm Corresponds to Confirm check box
HotZone[$] Measurement for hyphenation hot zone
[HACKER'S GUIDE ALERT: > For some unknown reason, UtilHyphenate leaves the document selected. That can be very disconcerting to a novice. Always do something like this:
Equivalent to the Sort command on the Utilities menu. The following table summarizes the arguments.
Argument Description
--------------- --------------------
Order Sorting order; can be 0 (ascending) or 1 (descending)
Type Sort type; can be 0 (alphanumeric), 1 (numeric), or 2 (date)
Separator Can be 0 (comma) or 1 (tab)
FieldNum[$] Field number
SortColumn Corresponds to the Sort Column Only check box
CaseSensitive Corresponds to the Case Sensitive check box
[HACKER'S GUIDE ALERT: > Until Microsoft fixes UtilSort, it's virtually useless. The problem is that there is only a fixed amount of memory that WinWord will use to sort. If WinWord hits a situation where it needs more memory, it just dies with a "Not Enough Memory" message. This is particularly galling when you have 7 Megs of free memory......(I had problems with this very same "quirk" in Word 4 and Word 5, as I recall. Maybe some day they'll fix it?)]
Equivalent to the Spelling command on the Utilities menu. The following table summarizes the arguments. The arguments correspond to check boxes.
Argument Description
--------------- --------------------
Word$ If Word$ is supplied, that word is used; if it is not supplied, Word searches forward from the insertion point for the next unmatched word
MainDic$ The main dictionary, a two-letter key; for example, "AM" for LEX-AM.DLL
SuppDic$ The supplemental dictionary
IgnoreCaps Corresponds to the Ignore ALL CAPS check box
AlwaysSuggest Corresponds to the Always Suggest check box
The Delete command button name can be appended to remove the word from the current supplemental dictionary.
:UtilSpellSelection
Syntax: UtilSpellSelection
Checks the selection. If the selection is only part of a word, the selection is expanded to include the whole word. The default supplemental dictionary is used.
:UtilThesaurus
Syntax: UtilThesaurus
Lists alternative words for the selection. Equivalent to the Thesaurus command on the Utilities menu.
:Val()
Syntax: Num = Val(A$)
Returns the numeric value of A$. [HACKER'S GUIDE ALERT: > There's a typo.
The last "Statement" should be:
Print A$ + " dozen equals" + Str$(Total) ]
:ViewAnnotations
Syntax: ViewAnnotations [On]
Turns on the annotations pane if On is nonzero, turns off the annotations pane is On is 0 (zero). Without the argument, toggles the annotations pane on and off.
:ViewAnnotations()
Syntax: Log = ViewAnnotations()
Returns -1 if annotations view mode is on, 0 (zero) if annotations view mode is off.
:ViewDraft
Syntax: ViewDraft [On]
Turns on draft view mode if On is nonzero, turns off draft view mode if On is 0 (zero). Without the argument, toggles draft view mode. If no window is open, the first window opened is opened in draft view.
:ViewDraft()
Syntax: Log = ViewDraft()
Returns -1 if draft view mode is on, 0 (zero) if draft view mode is off.
:ViewFieldCodes
Syntax: ViewFieldCodes [On]
Turns on field codes view mode if On is nonzero, turns off field codes view mode if On is 0 (zero). Without the argument, toggles field codes view mode. If no window is open, the first window opened shows field codes.
:ViewFieldCodes()
Syntax: Log = ViewFieldCodes()
Returns -1 if field codes view mode is on, 0 (zero) if field codes view mode is off.
:ViewFootnotes
Syntax: ViewFootnotes [On]
Turns on footnotes view mode if On is nonzero, turns off footnotes view mode if On is 0 (zero). Without the argument, toggles footnotes view mode. If no window is open, the first window opened is opened in footnotes view.
:ViewFootnotes()
Syntax: Log = ViewFootnotes()
Returns -1 if footnotes view mode is on, 0 (zero) if footnotes view mode is off.
Turns on outline view mode if On is nonzero, turns off outline view mode if On is 0 (zero). Without the argument, toggles outline view mode. If no window is open, the first window opened is opened in outline view.
:ViewOutline()
Syntax: Log = ViewOutline()
Returns -1 if outline view mode is on, 0 (zero) if outline view mode is off.
:ViewPage
Syntax: ViewPage [On]
Turns on page view mode if On is nonzero, turns off page view mode if On is 0 (zero). Without the argument, toggles page view mode. If no window is open, the first window opened is opened in page view.
:ViewPage()
Syntax: Log = ViewPage()
Returns -1 if page view mode is on, 0 (zero) if page view mode is off.
Equivalent to the Preferences command on the View menu. The following table summarizes the arguments. The arguments correspond to check boxes.
Argument Corresponds with
---------------- -----------------------------
Tabs Tabs check box
Spaces Spaces check box
Paras Paragraph Marks check box
Hyphens Optional Hyphens check box
Hidden Corresponds to the Hidden Text check box
ShowAll Corresponds to the Show All check box
DisplayAsPrinted Display As Printed check box
Pictures Pictures check box
TextBoundaries Text Boundaries check box
HScroll Horizontal Scroll Bar check box
VScroll Vertical Scroll Bar check box
TableGridlines Table Gridlines check box
StyleAreaWidth[$] Size occupied by style name area in the document window
[HACKER'S GUIDE ALERT: > When you turn on ViewSpaces - you're used to seeing those nice, little dots representing spaces, right? Most of the time, that's exactly what you get. Not so if you are using the Symbol of ZapfDingbat font. A space-dot in Symbol comes out to be a big, ugly bullet. A space-dot in ZapfDingbats comes up as a serif "2" in a solid circle. They're both character #183. Apparently, with View Spaces ON, WinWord captures character #32 (the space) and displays it as character #183. That's OK with most fonts, but not very good in Symbol of ZapfDingbats - and Character 183 will show up as a ± in any screen font built on the Roman-8 Symbol Set. Something similar happens to paragraph marks.]
:ViewRibbon
Syntax: ViewRibbon [On]
Turns on the ribbon if On is nonzero, turns off the ribbon if On is 0 (zero). Without the argument, toggles the ribbon. If no window is open, the first window opened is opened with the ribbon.
:ViewRibbon()
Syntax: Log = ViewRibbon()
Returns -1 if the ribbon is on, 0 (zero) if the ribbon is off.
:ViewRuler
Syntax: ViewRuler [On]
Turns on the ruler if On is nonzero, turns off the ruler if On is 0 (zero). Without the argument, toggles the ruler. If no window is open, the first window opened is opened with the ruler.
:ViewRuler()
Syntax: Log = ViewRuler()
Returns -1 if the ruler is on, 0 (zero) if the ruler is off.
:ViewShortMenus
Syntax: ViewShortMenus
Turns on short menus if On is nonzero, turns off short menus if On is 0 (zero). Without the argument, toggles short menus. If no window is open, the first window opened is opened in short menus.
:ViewStatusBar
Syntax: ViewStatusBar [On]
Turns on the status bar if On is nonzero, turns off the status bar if On is 0 (zero). Without the argument, toggles the status bar. If no window is open, the first window opened is opened with the status bar.
:ViewStatusBar()
Syntax: Log = ViewStatusBar()
Returns -1 if the status bar is on, 0 (zero) if the status bar is off.
:VLine
Syntax: VLine [Count]
Scrolls down vertically by Count lines. If Count is not specified, one line is the default. A negative Count scrolls up.
:VPage
Syntax: VPage [Count]
Scrolls down vertically by Count screens. If Count is not specified, one screen is the default. A negative Count scrolls up.
:VScroll
Syntax: VScroll Percentage
Scrolls vertically the specified percentage of the document length.
:VScroll()
Syntax: Num = VScroll()
Returns the current vertical scroll position as a percentage of the document's size.
:Wend
See "While"
:While...Wend
Syntax: While Condition
Statement(s)
Wend
Repeats the statements in the block while the Condition is True. If the Condition is initially False, the loop is never executed.
:Window()
Syntax: Num = Window()
Returns the number of the currently selected window. The number ranges from 1 to the number of open windows. The number corresponds to the number on the Window menu.
:Window1-Window9
Syntax: Windowx
Selects Window x. This number corresponds to the number on the Window menu. If you select a nonexistent window, an error is generated.
:WindowArrangeAll
Syntax: WindowArrangeAll
Arranges all open windows so that windows do not overlap.
:WindowName$()
Syntax: A$ = WindowName$(n)
Returns the title of the nth open window. The n corresponds to the number on the Window menu. If n is 0 (zero) or not supplied, the name of the current window is returned.
:WindowNewWindow
Syntax: WindowNewWindow
Equivalent to the New Window command on the Window menu. Creates a copy of the current window.
:WindowPane()
Syntax: Num = WindowPane()
If the window isn't split or if the top pane of the current window is selected, returns 1. If the bottom pane is selected, returns 3.
:WordLeft
Syntax: WordLeft [Repeat], [Select]
Moves the insertion point left by Repeat words, selecting if Select is nonzero.
:WordLeft()
Syntax: Log = WordLeft([Repeat], [Select])
Moves the selection left by Repeat words. Returns 0 (zero) if the action cannot be performed. For example, the function returns 0 if the insertion point is at the beginning of the document.
:WordRight
Syntax: WordRight [Repeat], [Select]
Moves the insertion point right by Repeat words, selecting if Select is nonzero.
:WordRight()
Syntax: Log = WordRight([Repeat], [Select])
Moves the selection right by Repeat words. Returns 0 (zero) if the action cannot be performed.
STATEMENT:
While WordRight(,1)
Wend
MEANING:
Selects one word at a time, until the end of the document is reached
:WordUnderline
Syntax: WordUnderline [On]
Without the argument, toggles word-only underlining for the entire selection. If On is nonzero, makes the entire selection word-only underlining. If On is 0 (zero), removes word-only underlining from the entire selection.
:WordUnderline()
Syntax: Log = WordUnderline()
Returns 0 (zero) if none of the selection is word underlined; 1 if all of the selection is underlined; or -1 if part of the selection is word underlined or more than one kind of underlining is used.
:Write
Syntax: Write [#]StreamNumber, Expressions
Writes the arguments to StreamNumber including delimiters so they can be read by the Read statement.