WD6x: "Subscript Out of Range" Running BatchConversion Macro |
Q114236
The information in this article applies to:
-
Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
-
Microsoft Word for Windows NT, version 6.0
-
Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a
SYMPTOMS
When you run the BatchConversion macro, supplied with Word for Windows as
part of the Convert.dot template file, the following error occurs if you
try to convert more than 500 files:
WordBasic Err=9
Subscript Out of Range
CAUSE
The BatchConversion macro defines a 500-item static array that contains the
names of the files in the source directory that you want to convert. The
array cannot accommodate more than 500 files, so the error occurs if the
number of files in the source directory exceeds that limit.
STATUS
Microsoft has confirmed this to be a problem in the versions of Word listed
at the beginning of this article. This problem was corrected in Word
version 7.0.
WORKAROUND
Method 1
Do not specify a source directory that contains more than a total of 500 of
any type of file. If you have more than 500 files, move them to separate
directories in groups of 500 or less.
Method 2
Remove the 500-file limit by modifying the BatchConversion macro using the
instructions below. To do this, follow these steps:
- Open the Convert.dot template file in Word. This template is located in
the MACROS subdirectory of your Word program directory (by default,
WINWORD\MACROS).
- From the Tools menu, click Macro.
- Select BatchConversion from the Macro Name list, and then click the Edit
button.
- From the Edit menu, click Find.
- In the Find What box, type Redim Temp$(500) and then click the Find Next button.
- Click the Close button in the Edit Find dialog box.
- In the "Redim Temp$(500)" string, change 500 to the number of files you
want to convert. For example, to convert 750 files, change the string to
"Redim Temp$(750)".
- Close the macro editing window. Click Yes when Word prompts you to save
the changes to the BatchConversion macro.
- Close Convert.dot. Click Yes when Word prompts you to save changes.
Microsoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may
want to contact a Microsoft Certified Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please see the following page on the World Wide Web:
http://www.microsoft.com/partner/referral/
For more information about the support options available from Microsoft, please see the
following page on the World Wide Web:
http://support.microsoft.com/directory/overview.asp
REFERENCES
"Microsoft Word User's Guide," version 6.0, pages 578, 580
Additional query words:
errmsg err msg batch conversion winword