Excel Automation - Access wants to re-open excel sheet when finish

P

pastotnikr

I am trying to build several custom reports in excel using data extracted
from access tables. I create my excel extract files using the DoCmd.OutputTo
acOutputTable method in my access module. At the very end, I export a final
table ts_ImportInfo (with some startup parameters) and open excel. I then use
the FollowHyperlink to open my ReportBuilder.xls file (into the same excel
instance).

DoCmd.OutputTo acOutputTable, "ts_ImportInfo", "MicrosoftExcel(*.xls)", _
SavePath & "\UPE_Period.xls", True, ""
FollowHyperlink CurrentProject.Path & "\ReportTemplates\ReportBuilder.xls"

The excel report builder launches, runs its' code and creates my custom
reports fine in an attended mode.

BUT when I try to automate for unattended operation, I have problems.

When I added application.quit to my code (in excel) to close excel at the
end the job, excel quits but then access tries to re-open the report builder
indicating it is trying to perform the FollowHyperlink command again.

How can I keep access from trying to open the file back up?
 

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