Microsoft KB Archive/95799

-

{| The information in this article applies to:
 * width="100%"|
 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c

SUMMARY
This article lists some of the more common reasons for a Microsoft WordBasic syntax error. When a syntax error occurs, WordBasic returns the following error message:

WordBasic Err=100: Syntax Error To troubleshoot the error, open the macro in the macro editing window and run the macro. Word for Windows highlights the macro line that contains the syntax error.

No Sub Main Command in the Macro
If no Sub Main command exists in a macro, the first line of the macro is highlighted as being the offending command. Every macro must have a Sub Main command.

A Missing Quotation Mark
A string must be enclosed by quotation marks (&quot;&quot;). An error is  generated if one or both are missing. For example, the syntax for the GetGlossary command specifies that the Name$ argument is a  string (&quot;GlossName&quot;).

A$ = GetGlossary$(&quot;GlossName&quot;, 1)

A Missing or Extra Comma
Each argument for a statement or function must be separated by a  comma. A missing comma or an extra comma generates an error. For example, each argument for the MsgBox command is separated by a  comma.

MsgBox &quot;Delete File?&quot;, &quot;Librarian&quot;, 289

A Missing Period
Each argument for a dialog-equivalent statement must begin with a  period. For example, the FileOpen statement includes an argument named &quot;.Name&quot;.

FileOpen .Name = &quot;MYDOC.DOC&quot;, .ReadOnly = 1

A Missing Reserved Word
Some WordBasic instructions include more than one reserved word. For example, an If conditional must include the Then reserved word.

If n = 10 Then Beep

A Reserved Word Name Conflict
WordBasic generates a syntax error if you create a variable name that matches a reserved word. For example, a variable named &quot;Then&quot; conflicts with the reserved word Then, which is part of a WordBasic If statement.

A Missing Parenthesis at the Beginning or End of a Function
A function always includes an opening and closing parenthesis. A  syntax error is generated if one or both are missing. Reference(s): &quot;Using WordBasic,&quot; by WexTech Systems and Microsoft, page 343
 * }

-

Last reviewed: July 30, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.