Microsoft KB Archive/95490

-

{| The information in this article applies to:
 * width="100%"|
 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c
 * Microsoft Excel for Windows, versions 3.0, 4.0
 * Microsoft Windows operating system versions 3.0, 3.1

SUMMARY
If you run a Microsoft Word for Windows macro from Microsoft Excel for Windows using DDE, Excel may temporarily hang (stop responding) if the Word macro contains the FileExit command. This happens if Word is minimized when you launch the macro from Excel. It does not happen if Word is maximized when you launch the macro from Excel.

When this happens, an error appears in the Excel spreadsheet cell from which you launched the Word macro. In Word, the following error message occurs after several seconds:

Microsoft Word: This task is taking longer than expected. Do you want to continue waiting? If you choose the Yes button, Excel continues to hang temporarily and Word does not close. If you choose the No button, Word appears to close and Excel stops hanging.

Workaround 1
Remove the FileExit command from the WordBasic macro and send it as a separate command from Microsoft Excel, via DDE. The following is a sample Excel macro that sends the FileExit command to Word:

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

Workaround 2
Add the AppMaximize command to your Word for Windows macro before the FileExit command, as shown in the following sample macro:

Sub Main AppMaximize FileExit End Sub

MORE INFORMATION
If you later attempt to launch Word after you receive the &quot;This task is taking longer...&quot; error message, the following error message occurs if you are not running the MS-DOS Share utility:

Word is already running. This happens even though Word is not running because a portion of the Word program still resides in memory. If this happens, exit and restart Windows. WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code &quot;as is&quot; 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.

Reference(s):

&quot;Microsoft Excel User's Guide 2,&quot; version 4.0, pages 299-304

&quot;Microsoft Excel User's Guide,&quot; version 3.0, pages 341-344

&quot;Microsoft Excel Function Reference,&quot; version 4.0, pages 139-140

&quot;Microsoft Excel Function Reference,&quot; version 3.0, pages 71-72
 * }

-

Last reviewed: July 30, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.