Using Application.quit is causing my macro to run and print twice...

K

Kathy

I've been displaying an Excel report in a browser window
via Java's getAppletContext().showDocument(url,"_blank")
with no problems. I then tried to do the same for
printing only after formatting I wanted to use the
following statements to print and exit out of Excel. The
problem is the application.quit is causing the macro to
run twice and give me two print outs. When I remove the
application.quit I get one print out but the browser
window stays open with my Excel report visible. Anyone
have any ideas as to why it's executing twice?

My code in Auto_Open is as follows:

Application.Visible = False
Application.WindowState = xlMinimized
Application.DisplayAlerts = False
Application.DefaultWebOptions.DownloadComponents =
False
Main <--- formats report
ActiveWorkbook.Saved = False
ActiveSheet.PrintOut
Application.Quit
 

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