Article ID: 103258
Article Last Modified on 1/18/2007
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.
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
Keywords: kberrmsg kbinterop kbprb kbprogramming KB103258