Hello,
I have a macro that runs each time when i open my file. I also wanne to use scheduler task so it runs everyday.
But i have in the macro also a save as and the problem is when i open it for the first time i have no problem. But when i open it for a second time he pop-ups the question if i want to replace the file.
I don't want him to ask it (or even do a save as) .
I would like him to do only the save only once a day.
i was thinking in the way of
"if file excist then don't do a save as otherwise do a save as."
beneath you can see what i for my save as:
Private Sub Workbook_Open()
...
ThisWorkbook.Save
Dim filenaam As String
Dim Sysdate
Sysdate = Format(Date, "ddmmyy")
filenaam$ = "F:\Users\Procurement\Contracts\Contract Files\" & "Contract File" & "_" & Sysdate & ".xlsx"
ActiveWorkbook.Sheets.Copy
ActiveWorkbook.SaveAs filenaam$, FileFormat:=51
ActiveWorkbook.Close
Kind regards,
Les
I have a macro that runs each time when i open my file. I also wanne to use scheduler task so it runs everyday.
But i have in the macro also a save as and the problem is when i open it for the first time i have no problem. But when i open it for a second time he pop-ups the question if i want to replace the file.
I don't want him to ask it (or even do a save as) .
I would like him to do only the save only once a day.
i was thinking in the way of
"if file excist then don't do a save as otherwise do a save as."
beneath you can see what i for my save as:
Private Sub Workbook_Open()
...
ThisWorkbook.Save
Dim filenaam As String
Dim Sysdate
Sysdate = Format(Date, "ddmmyy")
filenaam$ = "F:\Users\Procurement\Contracts\Contract Files\" & "Contract File" & "_" & Sysdate & ".xlsx"
ActiveWorkbook.Sheets.Copy
ActiveWorkbook.SaveAs filenaam$, FileFormat:=51
ActiveWorkbook.Close
Kind regards,
Les