PDA

View Full Version : Solved: save and rename workbook everyday at a given time



choubix
06-29-2008, 10:50 PM
hello,

I have this code that returns me an error (can't find project ofr library) when I run "Backup_WB"




Private Sub Workbook_Open()
'updates R_ELN at 3.00 am and saves the workbook at XXX everyday
Application.OnTime TimeValue("3:00:00"), "ELN_Update"
Application.OnTime TimeValue("13:53:00"), "Backup_WB"
'Gets data every day (5 days in advance)
Application.OnTime Now + TimeValue("23:59:59"), "ELN_Restructuring"
End Sub
Private Sub Backup_WB()
Dim Wk As Workbook
Set Wk = Workbooks.Add
Application.DisplayAlerts = False
Wk.SaveAs Filename:="P:/Product Monitors/Backup/02 Output" & _
Format(Date, "YYYYMMDD") & " " & Format(Time, "HHMMSS") & ".xls"

End Sub



does anybody know what's the problem please?

choubix
06-29-2008, 11:24 PM
ok, found a glitch: I didnt haev an addin on my computer required by the spreadsheet

jsut had to set the name of the workbook too (otherwise the file was a new empty one...)