WordBasic Error 52 Running BatchConversion Macro

Last reviewed: July 31, 1997
Article ID: Q155146
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c

SUMMARY

After you click Next in the first screen in the BatchConversion Wizard, you may receive a WordBasic Error #52, "Bad file name or number."

RESOLUTION

WARNING: ANY USE BY YOU OF THE OR MACRO CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

To resolve this problem, use the following steps:

  1. On the File menu, click Open.

  2. Change the List Files Of Type to Document Templates.

  3. Change the directory to \Winword\Macros.

  4. Select the Convert.dot, template and click OK.

  5. On the Tools menu, click Macros.

  6. Select the BatchConversion macro and click Edit.

  7. On the Edit menu, click Find, and find the second instance of "ini$."

  8. Change the following line in the macro

    x$ = GetPrivateProfileString$("MSWord Text Converters", CnvToUse$, ini$)

    to match the following code:

    x$ = GetPrivateProfileString$("MSWord Text Converters", CnvToUse$, "WINWORD6.INI")

  9. On the File menu, click Close and save the macro. Then, click Close on the File menu and save the template.

MORE INFORMATION

This problem may occur because the "windir" environment variable is a root directory, for example, "H:\."

By modifing the line in the macro to resemble the following

   ini$ = windir$ + "\winword6.ini"

you sets the variable "ini$" to equal the path to the Windows directory and the Winword6.ini file. This workaround corrects the problem if Windows is not installed or mapped to a root directory (for example windir=c:\windows) when "\winword6.ini" is added to the windir variable (for example ini$=c:\windows\winword6.ini).

However, if the windir variable is set to a root like "H:\" and the line reads "ini$=H:\\Winword6.ini," the double backslashes produce the error.

The workaround described in this article works because the filename$ argument of the GetPrivateProfileString$ function defaults to the Windows directory (whatever it happens to be) if no path is given to the file.

This problem has been resolved in Word for Windows 95 because all the entries that were previously read by the BatchConversion macro from the WINWORD6.INI file are now read from the registry.


KBCategory: kbprg kbmacro
KBSubcategory:

Additional query words: 6.0
Keywords : kbmacro kbprg
Version : 6.0 6.0a 6.0c
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 31, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.