windows7, excel 2010
I have a workbook that' s always open and i want to make autosave it everyday on a scheduled time.
I wrote the following code:
I have one problem with it, when i run the macro it will immediately create the file in the ddmmyy format. When the scheduled time arrives to autosave the file i get a conflict that says the file name already exist.
What is wrong in the code?
I have a workbook that' s always open and i want to make autosave it everyday on a scheduled time.
I wrote the following code:
Code:
Sub Autosave()
Application.OnTime TimeValue("18:10:00"), "Autosave"
ChDir "P:\Test"
ActiveWorkbook.SaveAs Filename:=Format(Date, "ddmmyy") & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
End Sub
What is wrong in the code?