Microsoft KB Archive/210481

= ACC2000: "The Other Application Quit" Error Message with MS Excel 4.0 =

Article ID: 210481

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210481



Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
When you quit Microsoft Excel over a dynamic data exchange (DDE) channel in Microsoft Access, you receive the following error message:

Run-time error '291':

The other application in the DDE conversation quit unexpectedly.



CAUSE
Microsoft Excel 4.0 automatically closes down any open DDE channels when it quits, rather than waiting for the DDE channels to be closed properly.



RESOLUTION
You can use one of the following two methods to work around this behavior. First, you can add an On Error Resume Next statement to your Microsoft Access function before the DDE quit command. The following sample function demonstrates this method: Function CallExcel Dim chan

x = Shell("C:\Excel\Excel.exe C:\Excel\Macro1.xlm", 1) chan = DDEInitiate("Excel", "System")

DDEExecute chan, "[Run(""Macro1.xlm!Message"")]" AppActivate "Microsoft Excel"

On Error Resume Next

DDEExecute chan, "[Quit]" DDETerminate chan End Function Second, you can have Microsoft Excel quit on its own, rather than having Microsoft Access send the Quit instruction. You can do this by having the second to last line in a Microsoft Excel macro call another macro. The first macro will contain a line similar to: =ON.TIME(NOW+"0:0:3","Leave") This will call a second macro in three seconds. The second macro will contain the two lines: =QUIT =RETURN

You can remove the DDE Quit command from your Microsoft Access function if you use this method.



Steps to Reproduce Behavior
The following sample function will open Microsoft Excel and run a macro named Message. When the function instructs Microsoft Excel to quit, the error message mentioned in the "Symptoms" section will occur. Function CallExcel Dim chan

x = Shell("C:\Excel\Excel.exe C:\Excel\Macro1.xlm", 1) chan = DDEInitiate("Excel", "System")

DDEExecute chan, "[Run(""Macro1.xlm!Message"")]" AppActivate "Microsoft Excel" DDEExecute chan, "[Quit]" DDETerminate chan End Function

