Pausing a Print macro and fixing print range

Mabocat

Board Regular
Joined
Apr 20, 2011
Messages
74
OK have a print macro that works well and combined it with Post #12 from
https://www.mrexcel.com/forum/excel-questions/39788-old-excel-macro-language-2.html
with a slight modification.

This is it from my spreadsheet
Code:
 Application.Wait (Now + TimeValue("0:00:20"))
    Application.Goto Reference:="Tawnton_print"
    ActiveSheet.PageSetup.PrintArea = "[COLOR=#ff0000]$A$1:$L$51[/COLOR]"
    ActiveWindow.SelectedSheets.PrintOut From:=2, To:=2, Copies:=2, Collate _
        :=True, IgnorePrintAreas:=False
    Range("A1").Select
End Sub

What I would like it to do is not only wait or pause, but bring up a Message box with the Words "Reload Tawnton pages" with a OK button so once I have physically re-loaded the pages ( which are on the reverse side of previously printed pages), pressing return key or clicking on the OK button, the macro continues to process & print.

I also new to amend the text colour red words to be "Tawnton_print" range as this could vary from A1:L51 to A1: L40 or A1:L60

previous advice has been to use CurrentRegion.Select but not sure where is goes in the above coding

Ron
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I managed to find out about a message box using MsgBox and removed the
Application.Wait (Now + TimeValue("0:00:20"))

works well
 
Upvote 0
So a question re range variations

I have this instruction
Code:
ActiveSheet.PageSetup.PrintArea = "$A$1:$L$51"

but because the range could change even though it was first selected like this
Code:
Application.Goto Reference:="Tawnton_print"

it seems to me after some testing that this will do the trick to allow for increase/decrease in the actual range after the Goto instrcution
Code:
Selection.CurrentRegion.Select

so instead of this
Code:
Application.Goto Reference:="Tawnton_print"
    ActiveSheet.PageSetup.PrintArea = "$A$1:$L$51"
    ActiveWindow.SelectedSheets.PrintOut From:=2, To:=1, Copies:=2,

it will be this
Code:
Application.Goto Reference:="Tawnton_print"
    Selection.CurrentRegion.Select
    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1,


is this the best way of handling possible actual range variations ?

Ron
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,577
Messages
6,125,637
Members
449,242
Latest member
Mari_mariou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top