Closing Excel from Access Macro

M

Melinda

Hello,
I have a database that opens Excel with the
RunApplication command from the Macro Builder. Is there
a way that I can tell Access to close Excel after a
couple of other commands? I'm a pretty novice programmer.
Thanks!
Melinda
 
K

Ken Snell [MVP]

Not directly in a macro line. But you could write a function that will do
this (put the function in a regular module):

Public Function CloseMyExcel()
Excel.Application.Quit
End Function


Then call this function using a RunCode macro line.
 
M

Melinda

Thanks for help. That worked perfectly. Now, my problem
is that Excel isn't open by the time that it tried to
close it. Is there a way to make the macro pause?
 
K

Ken Snell [MVP]

I'm not following you here. Are you wanting to use the same macro to both
open and then close EXCEL? What is happening inbetween?

I'm guessing that you should run the "Close of EXCEL" macro as a separate
macro that you trigger when you're ready for EXCEL to close.
 
L

LAM

I am having the same problem trying to close Excel when finished with it. I
have tried to use a macro with RunApp but am so new at this I am not even
sure what to put when it asks for function name. Help please
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top