Print upon opening document, but only at a certain time of day

Dantrith

New Member
Joined
Oct 22, 2014
Messages
34
Title says it all really. I have a workbook that upon opening I want to refresh, run a macro, then print. I'm pretty sure I can do all that but I want to limit the time so that unless someone happens to open it at 6:58 am it won't automatically print.
Thanks
 
Private Sub Workbook_Open()

ActiveWorkbook.RefreshAll
If Date = Sheets("Report").Range("B2") Then
'checks if date in B2 his todays date, if it is todays date then it skips down to samedate.
GoTo SameDate
End If
'changes the date to todays date so that if the file is opened later
'that day then it doesn't print pages automatically.
Sheets("Report").Range("B2") = Date

Call ColorAllColumns
Call printreport

ActiveWorkbook.Close


SameDate:

End Sub

This was the code that did it. It doesn't quite do it how I originally imagined but it doesn't automatically print 5 pages the next time the user opens the book which was the end goal.
 
Upvote 0

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