Updaing Excel charts in Access reports

  • Thread starter Marie via AccessMonster.com
  • Start date
M

Marie via AccessMonster.com

I have created the following macro to export query results to Excel.
The macro opens Excel with the query results.
I have created an Auto Open macro in Excel to use the query results to create
a chart and copy the chart to the clipboard.
The macro then opens the Access report and pastes the chart into the report.
When I close the Access report, I am not saving.
The problem I am having is in the sequence of events.
The first time I run the macro it works great.
However, if the query data is updated and I rerun the macro the chart that is
copied to the report is the chart created when the macro was previously run.
I'm not sure if it has anything to do with the fact that the report is opened
before the auto open macro is running in Excel. (I can see the report icon on
the task bar at the same time I am prompted to Disable/Enable macros in Excel)
..

Open Query - runs query in Access
Transfer Spreadsheet - exports query results to Excel
RunApp - opens the query result spreadsheet file in Excel
OpenReport - opens Access report which will contain the chart in Design view
RunCommand - pastes the chart onto the report
OpenReport - in print preview

I am new to coding VB, however if someone could send me the correct code for
this process to work I would be willing to give it a try.

Any help would be greatly appreciated as I am reaching my deadline soon!
Thank you,
Marie
 
Top