Macro to Refresh Data & Print

  • Thread starter Thread starter cruwyser
  • Start date Start date
C

cruwyser

Hi all,

I have a small problem.....I am currently using Excel to import some
external data from an Oracle database. As this is a report, the process
needs to be automated, hence I need a macro.

I need to generate a macro which refreshes the data in the worksheet,
then prints the report out and closes the workbook/applciation.

I have generated the macro, but the macro prints the report before the
data has refreshed.

Tried various versions of pause/wait/sleep, but still cant get it to
work?

Any ideas would be of great help!

Many thanks in advance.:)
 
By setting the BackgroundQuery property to False the code (and Excel)
will wait for the refresh to complete.

Range("Whatever").QueryTable.Refresh BackgroundQuery:=False should work
 

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

Back
Top