Excel: WordBasic Macro with FileExit Command Hangs Computer

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("winword","system")
   A2: =EXECUTE(A1,"[ToolsMacro.Name=""test"",.Run]")
   A3: =EXECUTE(A1,"[FileExit]")
   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.

REFERENCES

"Microsoft Excel User's Guide 2," version 4.0, pages 299-304 "Microsoft Excel User's Guide," version 3.0, pages 341-344 "Microsoft Excel Function Reference," version 4.0, pages 139-140 "Microsoft Excel Function Reference," version 3.0, pages 71-72


KBCategory: kbprb
KBSubcategory:

Additional reference words: 4.0 4.00 3.0 3.00



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: January 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.