WD: "Illegal Function Call" Error When Using a Dialog Box

ID: Q45745

The information in this article applies to:

The following are possible causes of an "Illegal function call" (Err=5) in a macro that includes a dialog box:

1. The location or size of the dialog box causes the box or some

   portion of the box to be off the screen. This can be identified by
   the error occurring at the "Begin Dialog" statement.

2. The dialog box definition does not include an OK and/or Cancel button.
   This error can be identified by the error occurring at the "Dialog"
   statement.

3. The dialog box is larger than the maximum size of a dialog box.
   For example:

      Begin Dialog UserDialog 5000, 5000

   The above coordinates exceed the maximum size.

4. Specifying more than one OK or Cancel button in a Microsoft WordBasic
   custom dialog box causes the error message.

   Note: You can specify a single OK or Cancel button and rename the
   buttons.

5. No buttons (OK, cancel, etc.) will cause the "illegal function call"
   error message. The dialog has to have a way to exit.

6. In Word 7.0, the error can be caused by a corrupt wordwiz.ini file. The wordwiz.ini is used by the wizards to store information about the wizard options you choose the last time you ran the wizard. Renaming or deleting the wordwiz.ini will restore the default wizard settings.

   For more information, query on the following:

      creating and custom and OK and cancel and buttons and word and
      windows

KBCategory:   kbusage kbmacro
KBSubcategory: Additional query words: 1.0 1.1 1.1a 2.0 1.x winword2 word6 6.0.1 7.0 word95 winword 2.0 2.0a 2.0a-CD 2.0b 2.0c 6.0 6.0a 6.0c macword word7
Keywords          : kberrmsg kbmacro wordnt winword ntword macword word6 winword2 word7 word95 
Version           : WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a- CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a

Last Reviewed: February 3, 1998