Microsoft KB Archive/94632

{| = Excel: WordBasic Macro with FileExit Command Hangs Computer =
 * width="100%"|

Last reviewed: January 3, 1997

Article ID: Q94632 The information in this article applies to:


 * Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a

SUMMARY
Microsoft Excel for Windows hangs when you run a WordBasic macro that contains a FileExit command. This problem occurs under the following conditions:

 Dynamic data exchange (DDE) is used to run a version 2.0 Microsoft Word for Windows macro. -and- The FileExit command is used to exit the Word for Windows application.

MORE INFORMATION
You can use DDE to run WordBasic macros from a Microsoft Excel macro. When the WordBasic macro contains the FileExit command, Microsoft Excel returns an error to the cell in the macro sheet containing the Execute statement and temporarily hangs your computer. After 30 seconds to a minute, you will be able to use your computer; however, the FileExit command will not successfully close Microsoft Word for Windows (this command should close Microsoft Word). If you switch to Word for Windows, you will receive the following error message:

Microsoft Word: This task is taking longer than expected. Do you want to continue waiting? If you choose the Yes button in the error message dialog box, Word for Windows will not be closed and your computer will continue to hang. If you choose the No button in the error message dialog box, you will close Microsoft Word.

Workaround
To work around this problem, remove the FileExit command from the WordBasic macro and instead use DDE to execute this command. A sample macro follows:

A1: =INITIATE(&quot;winword&quot;,&quot;system&quot;) A2: =EXECUTE(A1,&quot;[ToolsMacro.Name=&quot;&quot;test&quot;&quot;,.Run]&quot;) A3: =EXECUTE(A1,&quot;[FileExit]&quot;) A4: =TERMINATE(A1) A5: =RETURN The above macro initiates a DDE channel to Word for Windows and runs a macro called Test. Once the macro is completed, Word for Windows will quit and the channel is terminated.