Err Msg: WordBasic Err=9 in NEWMACRO.DOCLast reviewed: February 5, 1998Article ID: Q109570 |
The information in this article applies to:
SYMPTOMSWhen you open Newmacro.doc, included with Word for Windows 2.0, you may receive the following WordBasic error message when the AutoOpen macro runs:
WordBasic Err=9 Subscript out of range.This problem does not occur when you open the NewMacro.doc file in Word 97. Instead Word 97 alerts you that the macros will not be converted when you open the template in Word 97.
CAUSEThe "Subscript out of range" error message refers to an array element with a subscript outside the defined dimensions of the array, or an array element that has the wrong number of subscripts. For example, the subscript for the array element variable "Item$(2)" is 2, which means the element is to occupy the third position in the array. If the array has been dimensioned to contain only one element, as in the statement "Dim Item$(0)," specifying the variable "Item$(2)" in the macro will generate the "Subscript out of range" error message because it references a third position in the array when there is only one position available. In the case of Newmacro.doc, the AutoOpen macro searches for the number of macros in the document and loads an array with the macro names. If the number of macros that begin with "Auto" in NEWMACRO.DOC is not exactly 22, you may receive the "Subscript out of range" error message. The following line in the AutoOpen macro should be adjusted to correspond to 2 less than the total number of macros in NEWMACRO.DOC that begin with "Auto":
cAutoMacros = 20 RESOLUTIONChange the number in the cAutoMacros=20 line to 2 less than the total number of macros in Newmacro.doc that begin with "Auto." For example, if you delete the macro "AutoFootnoteEntry," there will be a total of 21 macros in NEWMACRO.DOC that begin with "Auto." To prevent the "Subscript out of range" error message, change the above macro line to:
cAutoMacros = 19 REFERENCES"Using WordBasic," by WexTech Systems, page 341 "Microsoft Word Developer’s Kit," version 6.0 for Word 6.0 for Windows, page 829
|
KBCategory: kbusage kbmacro kberrmsg
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |