Hello everyone,
I have small issue which can not solve myself. I would like to have macro which create a copy of existing Excel file during saving. The name of new file should looks like this: hh.mm.ss_dd.mm,yyyy, where hh is creation hour, mm means minute and so one. I have created such a macro but someting is wrong with them.
I will appreciate if you could correct below code.
Private Sub Workbook_BeforeSave(ByVal SaveAsUi As Boolean, Cancel As Boolean)
Dim Nazwa As String
Dim Sciezka As String
Sciezka = "D:\"
Nazwa = Format(Now(), "hh.mm.ss_dd.mm.yy") & ".xls"
ThisWorkbook.Save
ActiveWorkbook.SaveAs FileName:=Sciezka & Nazwa
End Sub
Bookmarks