ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need a pause in my macro before printing (https://www.excelbanter.com/excel-programming/431814-need-pause-my-macro-before-printing.html)

chas

Need a pause in my macro before printing
 
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

Don Guillett

Need a pause in my macro before printing
 
As always post YOUR code for comments. Could be

application.enableevents=false
code
application.enableevents=true

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Chas" wrote in message
...
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



chas

Need a pause in my macro before printing
 
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

"Chas" wrote:

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


chas

Need a pause in my macro before printing
 
Still having the same trouble. It prints, then finishes the refresh &
calculations.

Thanks for taking to time.

"Don Guillett" wrote:

As always post YOUR code for comments. Could be

application.enableevents=false
code
application.enableevents=true

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Chas" wrote in message
...
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




Don Guillett

Need a pause in my macro before printing
 
try this or have your query .Refresh BackgroundQuery:=False

application.enableevents=false
ActiveWorkbook.RefreshAll

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Chas" wrote in message
...
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

"Chas" wrote:

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



chas

Need a pause in my macro before printing
 
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

"Don Guillett" wrote:

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

application.enableevents=false
ActiveWorkbook.RefreshAll

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Chas" wrote in message
...
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

"Chas" wrote:

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




Don Guillett

Need a pause in my macro before printing
 
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.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Chas" wrote in message
...
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

"Don Guillett" wrote:

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

application.enableevents=false
ActiveWorkbook.RefreshAll

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Chas" wrote in message
...
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

"Chas" wrote:

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






All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com