Auto print

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I get to print sheet2 every monday at 100:00am. Can the formula below
be modified and used?

Sub timer()
Application.OnTime TimeValue("10:00:00"), "Print_Out"
End Sub
 
hi.
macro's don't start themselves. they are triggered by some event. you could
put this code in the workbook open event so that each morning this code would
check to see if it's monday yet. or if the file is not open, you could put it
in your personal workbook in the xl startup folder so that the code will fire
when you open excel. add a line to open the file and print.
your job... your call. but you will need a way to trigger it. and the file
will have to be open.

If Weekday(Now()) = 2 Then '1 = Sunday, 2 = Monday, 3 = Tuesday, ect
Application.OnTime TimeValue("10:00:00"), "Print_Out"
Else
Exit Sub
End If
If it's monday, the on time event will wait untill 10 then call Print_out.
if it's not monday, the code quits.

Regards
FSt1
 
You may be better off to use Task Scheduler to start Excel, open the workbook
and have an Auto_Open sub run the print job.


Gord Dibben MS Excel MVP
 
Thanks Gord,
If I went that way how would the code be written to
auto_open sub run the print job?
 
In a general module:

Option Explicit
Sub Auto_Open()
worksheets("Sheet5").printout
'close the workbook???
thisworkbook.close savechanges:=false
end sub

Remember that each time you open this workbook, this macro will run. You can
turn off macros and open it or hold the shift key down while opening the
workbook to avoid running this code.
 
Thanks all,
The code that works as follows:
Private Sub Workbook_Open()

Application.ScreenUpdating = False
Sheet1.Activate

If Weekday(Now()) = 2 Then '1 = Sunday, 2 = Monday, 3 = Tuesday, ect

Application.OnTime TimeValue("00:52:00"), "Macro1"

Else
Exit Sub
End If
Sheet1.Activate
Application.ScreenUpdating = True
End Sub

With task scheduling, one still needs to enable macros for it to proceed. So
not totally automatic. No way round that i supose!!?
 
Back
Top