Microsoft KB Archive/103258: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 12: Line 12:
<div id="TitleRow">
<div id="TitleRow">


= <span id="KB103258"></span>ACC: Err Msg &quot;The Other Application Quit&quot; with MS Excel 4.0 =
= <span id="KB103258"></span>ACC: Err Msg "The Other Application Quit" with MS Excel 4.0 =




Line 79: Line 79:
<pre class="codesample">  Function CallExcel ()
<pre class="codesample">  Function CallExcel ()
       Dim chan
       Dim chan
       x = Shell(&quot;c:\excel\excel.exe c:\excel\macro1.xlm&quot;, 1)
       x = Shell("c:\excel\excel.exe c:\excel\macro1.xlm", 1)
       chan = DDEInitiate(&quot;Excel&quot;, &quot;System&quot;)
       chan = DDEInitiate("Excel", "System")
       DDEExecute chan, &quot;[Run(&quot;&quot;macro1.xlm!Message&quot;&quot;)]&quot;
       DDEExecute chan, "[Run(""macro1.xlm!Message"")]"
       AppActivate &quot;Microsoft excel&quot;
       AppActivate "Microsoft excel"
       On Error Resume Next
       On Error Resume Next
       DDEExecute chan, &quot;[quit]&quot;
       DDEExecute chan, "[quit]"
       DDETerminate chan
       DDETerminate chan
     End Function
     End Function
                 </pre>
                 </pre>
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
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
<pre class="codesample">  =ON.TIME(NOW()+&quot;0:0:3&quot;,&quot;Leave&quot;)
<pre class="codesample">  =ON.TIME(NOW()+"0:0:3","Leave")
                 </pre>
                 </pre>
that will call a second macro in three seconds. The second macro will contain the two lines:
that will call a second macro in three seconds. The second macro will contain the two lines:
Line 104: Line 104:
=== Steps to Reproduce Behavior ===
=== 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 &quot;Symptoms&quot; section will occur.
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.
<pre class="codesample">  Function CallExcel ()
<pre class="codesample">  Function CallExcel ()
       Dim chan
       Dim chan
       x = Shell(&quot;c:\excel\excel.exe c:\excel\macro1.xlm&quot;, 1)
       x = Shell("c:\excel\excel.exe c:\excel\macro1.xlm", 1)
       chan = DDEInitiate(&quot;Excel&quot;, &quot;System&quot;)
       chan = DDEInitiate("Excel", "System")
       DDEExecute chan, &quot;[Run(&quot;&quot;macro1.xlm!Message&quot;&quot;)]&quot;
       DDEExecute chan, "[Run(""macro1.xlm!Message"")]"
       AppActivate &quot;Microsoft excel&quot;
       AppActivate "Microsoft excel"
       DDEExecute chan, &quot;[quit]&quot;
       DDEExecute chan, "[quit]"
       DDETerminate chan
       DDETerminate chan
   End Function
   End Function
Line 121: Line 121:
== REFERENCES ==
== REFERENCES ==


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


</div>
</div>

Latest revision as of 09:26, 20 July 2020

Article ID: 103258

Article Last Modified on 1/18/2007



APPLIES TO

  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition
  • Microsoft Access 97 Standard Edition



This article was previously published under Q103258

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 following 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

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")
                

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: kberrmsg kbinterop kbprb kbprogramming KB103258