ACC: Err Msg "The Other Application Quit" with MS Excel 4.0

Last reviewed: August 29, 1997
Article ID: Q103258
The information in this article applies to:
  • Microsoft Access versions 1.1, 2.0, 7.0, 97

SYMPTOMS

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

When you are quitting Microsoft Excel over a dynamic data exchange (DDE) channel in Microsoft Access versions 1.1, 2.0, and 7.0, you may receive the following error message:

   The Other Application Quit

In Microsoft Access 97, you may receive the error message:

   Run-time error '291'.
   The other application in the DDE conversation quit unexpectedly.
   Restart the other application before reinitiating the DDE conversation.

CAUSE

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

RESOLUTION

There are two methods to work around this behavior. The first method is to add an On Error Resume Next statement to your Microsoft Access function, before the DDE quit command. The sample function below 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

The second method is to 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")

that 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.

MORE INFORMATION

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

REFERENCES

For more information about the DDEInitiate() function, search the Help Index for "DDEInitiate," or ask the Microsoft Access 97 Office Assistant.

Keywords          : IntpDde kberrmsg kbinterop
Version           : 1.1 2.0 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbprb
Solution Type     : Info_Provided


================================================================================


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