printing at a time!!

garryt1

New Member
Joined
Feb 12, 2003
Messages
16
:rolleyes:

Hi,

I am trying to print a sheet out automatically at a certain time, i can't seem to get a macro to do this whenever the sheet is activated already.
Could someone please point me in the right direction??

thanks in advance.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi Garry...do you mean you have the workbook open, with the sheet you want printed as the active sheet, but you want it to print at a certain time without someone hitting the button??

Not sure if I can help...but I'll give it a shot.... :eek:

Dave M.
 
Upvote 0
Hi Davers,

"Hi Garry...do you mean you have the workbook open, with the sheet you want printed as the active sheet, but you want it to print at a certain time without someone hitting the button?? "

You hit the nail on the head buddy, i can get it to print when the workbook opens but i cannot get it to print automatically at a certain time .

any help welcome!!!!!!
 
Upvote 0
Have a look in he VB Help files

While in the VBE Press F1
Then Type in "OnTime"

It is the OnTime Method you need....Help has example.
Post back if you require furtgher help.
 
Upvote 0
Hi Again!!

I tried what you suggested but still to no avail.I have been working at this today and can get the sheet to print if i excecute the code manually but it will not work on the time event.

Help!!!!!!!!!!!!!!!!!
 
Upvote 0
Hi Gary...I think I may have it...put this bit o' code in the "ThisWorkbook" object:

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Open()

    <SPAN style="color:#00007F">Set</SPAN> Test.AppEvent = Excel.Application
    Application.OnTime Now + TimeValue("00:00:30"), "prntPage"

<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>

and this bit o' code in Module1:

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> prntPage()

    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=<SPAN style="color:#00007F">True</SPAN>
    
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>

The first bit is telling it to run the code in Module1 30 seconds after you open the workbook...this line here specifies the time to run the print part:

Now + TimeValue("00:00:30")

the Now is the usual now function in excel...and the time value is self explanatory. To change the code to have it run at a specific time of day...say at 2:45 PM...you would use:

Application.OnTime TimeValue("2:45 PM"), "prntPage"

Let me know if this helps you out or at least points you in the right direction.....

Dave M. o_O
 
Upvote 0
Hi Davers,

Excel-ent !!!!!!!!! The only thing was that i did not need to use the top line of code in the workbook object:
It would not work and highlighted AppEvent as requiring an object,but after some toying about i deleted the top line and it worked perfectly.

cheers mate!!!!
 
Upvote 0

Forum statistics

Threads
1,215,044
Messages
6,122,827
Members
449,096
Latest member
Erald

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