Microsoft KB Archive/155146

{|
 * width="100%"|

WordBasic Error 52 Running BatchConversion Macro

 * }

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:

 On the File menu, click Open. Change the List Files Of Type to Document Templates. Change the directory to \Winword\Macros. Select the Convert.dot, template and click OK. On the Tools menu, click Macros. Select the BatchConversion macro and click Edit. On the Edit menu, click Find, and find the second instance of "ini$."  Change the following line in the macro <pre class="CODESAMP">  x$ = GetPrivateProfileString$("MSWord Text Converters", CnvToUse$, ini$) to match the following code: <pre class="CODESAMP">  x$ = GetPrivateProfileString$("MSWord Text Converters", CnvToUse$, "WINWORD6.INI") </li> On the File menu, click Close and save the macro. Then, click Close on the File menu and save the template.</li></ol>

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

<pre class="CODESAMP">  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.

Additional query words: 6.0

Keywords : kbofficeprog

Issue type :

Technology :