Microsoft KB Archive/138729

{|
 * width="100%"|

WD: WordBasic: Error Using FileOpen to Open More Than One File

 * }

Q138729

-

The information in this article applies to:


 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1
 * Microsoft Word for Windows, version 7.0

-

SYMPTOMS
When you use the WordBasic FileOpen command to open more than one file at once, you may receive the following error message:

Error 1078 - This file could not be found

If you use the same command line in Word 6.x for Windows or Word 6.0 for Windows NT, this error does not occur.

CAUSE
This behavior is by design. Word for Windows 95 and Word 6.x for the Macintosh both run under operating systems that support long file names. Because long file names can contain spaces, there is no way to determine whether a specified file name is intended to be one file or multiple files.

Consider the following macro sample, which is intended to open two files, Test1.doc and Test2.doc:

  Sub MAIN FileOpen .Name="TEST1.DOC TEST2.DOC" End Sub Because a file named "TEST1.DOC TEST2.DOC" does not exist, the macro fails.

MORE INFORMATION
Word version 6.0 for Windows NT does not have this behavior because it doesn't support spaces in file names. Word for Windows NT interprets the space as a file delimiter and, therefore, tries to open multiple files when it encounters spaces. For example, if you have a file called "My file.doc," it won't open with the WordBasic FileOpen command in Word for Windows NT because files called "My" and "File.doc" don't exist.

When designing Word for Windows 95, to solve the problem of long file names, Microsoft changed the way the WordBasic FileOpen command worked. The command no longer supports opening multiple files.

In general, it is not good programming practice to try to open more than one file at once. If you open each file separately, you can determine which files cannot be opened.

Additional query words:

Keywords : kberrmsg kbmacro kbmacroexample winword macword word7 word95

Issue type : kbinfo

Technology :