What i ultimatly want to achive is that i save the active workbook under the name of the date today in the path i choose. I wrote a little code for that, that partly helped me.
the code is as follows:
now this works. better than i hoped, actually. one little thing though. I cant override the current file, if this file already exists. When i try to save again with this macro i somehow get the error that the path could not be found. Is there any workaround for that?
Also, and that would be the cherry on top, it would be perfect if it didnt open the newly saved file, but let the original file open. What i mean is that if i save the file named "Historymaker" with this macro, it would automatically open the file "04-12-2021.xlsm", which i want to avoid. <--- is no must tho.
the code is as follows:
VBA Code:
Sub save()
Dim location As String
location = ThisWorkbook.Path
ChDir location & "\History"
ThisFile = Format(Date, "dd-mm-yyyy") & ".xlsm"
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
now this works. better than i hoped, actually. one little thing though. I cant override the current file, if this file already exists. When i try to save again with this macro i somehow get the error that the path could not be found. Is there any workaround for that?
Also, and that would be the cherry on top, it would be perfect if it didnt open the newly saved file, but let the original file open. What i mean is that if i save the file named "Historymaker" with this macro, it would automatically open the file "04-12-2021.xlsm", which i want to avoid. <--- is no must tho.