WD6x: "Subscript Out of Range" Running BatchConversion Macro

ID: Q114236

The information in this article applies to:

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:

a. 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).

b. From the Tools menu, click Macro.

c. Select BatchConversion from the Macro Name list, and then click the Edit

   button.

d. From the Edit menu, click Find.

e. In the Find What box, type "Redim Temp$(500)" (without the quotation

   marks) and then click the Find Next button.

f. Click the Close button in the Edit Find dialog box.

g. 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)".

h. Close the macro editing window. Click Yes when Word prompts you to save
   the changes to the BatchConversion macro.

i. 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 the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/

REFERENCES

"Microsoft Word User's Guide," version 6.0, pages 578, 580

Additional query words: errmsg err msg batch conversion winword

Keywords          : kbmacro kbtemplate wordnt ntword macword word6 word7 word95 
Version           : WINDOWS:6.0,6.0a,6.0c; MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: April 9, 1999