Need a pause in my macro before printing

C

Chas

I have a macro that basically refreshes several queries & performs some other
basic task. I need to add code that will then print a final report (which is
just printing one of the tabs). The problem I'm having is that when I add a
pause, it seems to pause the refreshing process then it ends up printing
before all of the refreshes are complete. Any suggestions, I'm very new to
VBA so I'm sure this is an easy fix that I'm overlooking.

Thanks
 
D

Don Guillett

As always post YOUR code for comments. Could be

application.enableevents=false
code
application.enableevents=true
 
C

Chas

Sorry I forgot to add the code currently being used

ActiveWorkbook.RefreshAll
Sheets("JOB COST SUMMARY").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Again, the problem is that it prints before the refresh in complete, I want
it to print when the refresh is done.


Thanks Again
 
C

Chas

Still having the same trouble. It prints, then finishes the refresh &
calculations.

Thanks for taking to time.
 
D

Don Guillett

try this or have your query .Refresh BackgroundQuery:=False

application.enableevents=false
ActiveWorkbook.RefreshAll

application.enableevents=true
Sheets("JOB COST SUMMARY").PrintOut
 
C

Chas

Thanks Don, but still no luck. Do you think it's because there's multiple
queries on different sheets? The way it looks now, there is a slight pause
before the printing but then it goes to on to refresh & calculate (you can
see the status in bottom left corner), it appears that it refreshes the first
tab (Job Cost Summary), then prints that tab, then refreshes & recalculates
the remaining sheets which doesn't work because all the other sheets are
summarized on the first tab (Job Cost Summary).

I've also tried your code with a "Wait" before the printing, and no luck.

Any other suggestions are greatly appreciated and I really appreciate the
help you've already given.

Thanks
 
D

Don Guillett

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.
 

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