If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
How do I schedule a task to print a document
Good to hear that.
Gord On Tue, 12 Jun 2007 03:59:02 -0700, Hershmab wrote: Just to thank you - I have got everything working now, have found Selfcert and VBA help. "Gord Dibben" wrote: See responses in-line On Thu, 7 Jun 2007 16:37:00 -0700, Hershmab wrote: Sorry to have to ask more, but as I just said below I do not have VBA help. (How can I install it?) Control PanelAdd or Remove ProgramsChangeAdd or Remove Features Make sure VBA Help is installed to run from My Computer............you may need a CD (1) I have set my macro security level to high and (tried to) digitally sign the relevant VBA project with an existing and valid certificate But every time I exit the VBA, the digital signature disappears! I do not know whether to save the workbook or not after resetting the signature. NB: I have macros in Word also, but I do not get the same problems with validating them, even though security is set to medium and the macros are NOT digitally signed. I don't know what's going on there. Have you tried using a signature created by Office SelfCert tool? (2) I have added the workbook to my task schedule, but (a) it keeps on requiring interactive response about enabling macros That will clear up when you get your signature working properly (b) Excel does not close down after printing (and requires a save/no-save response). Add a couple of lines to the Workbook_Open code ThisWorkbook.Close SaveChanges:=True 'if you want to save Application.Quit OR if you don't want to save ThisWorkbook.Saved = True ThisWorkbook.Close Application.Quit (c) apart from that the macro works, but it would be much simpler if I could simply schedule a print-only task as from Explorer. Excel has no command-line "print" function. Gord |
#12
|
|||
|
|||
How do I schedule a task to print a document
Gord,
Thanks for the code. It works great for what I need. However, I do have one issue. I am using the below code: Private Sub Workbook_Open() Dim MyDate, MyWeekDay MyDate = Date MyWeekDay = Day(MyDate) If MyWeekDay = 28 Then Sheets("Sheet1").PrintOut Else MsgBox "No Auto Print. Not the 28th" End If ThisWorkbook.Saved = True Application.Quit End Sub I need to print my excel file on the 28th and the above code does that. I will place a shortcut to the excel file so scheduled tasks can print it on the 28th. However, the issue is that the user will need to get in the file on other days too to make some edits. If he/she opens the file it will give them the msgbox and close the file out. Is there something we can add that tells it not to close if its not the 28th so the user can get in and make changes and save? Thanks. "Gord Dibben" wrote: Good to hear that. Gord On Tue, 12 Jun 2007 03:59:02 -0700, Hershmab wrote: Just to thank you - I have got everything working now, have found Selfcert and VBA help. "Gord Dibben" wrote: See responses in-line On Thu, 7 Jun 2007 16:37:00 -0700, Hershmab wrote: Sorry to have to ask more, but as I just said below I do not have VBA help. (How can I install it?) Control PanelAdd or Remove ProgramsChangeAdd or Remove Features Make sure VBA Help is installed to run from My Computer............you may need a CD (1) I have set my macro security level to high and (tried to) digitally sign the relevant VBA project with an existing and valid certificate But every time I exit the VBA, the digital signature disappears! I do not know whether to save the workbook or not after resetting the signature. NB: I have macros in Word also, but I do not get the same problems with validating them, even though security is set to medium and the macros are NOT digitally signed. I don't know what's going on there. Have you tried using a signature created by Office SelfCert tool? (2) I have added the workbook to my task schedule, but (a) it keeps on requiring interactive response about enabling macros That will clear up when you get your signature working properly (b) Excel does not close down after printing (and requires a save/no-save response). Add a couple of lines to the Workbook_Open code ThisWorkbook.Close SaveChanges:=True 'if you want to save Application.Quit OR if you don't want to save ThisWorkbook.Saved = True ThisWorkbook.Close Application.Quit (c) apart from that the macro works, but it would be much simpler if I could simply schedule a print-only task as from Explorer. Excel has no command-line "print" function. Gord |
|
Thread Tools | |
Display Modes | |
|
|