Theoutlaw700
New Member
- Joined
- Jun 8, 2022
- Messages
- 8
- Office Version
- 365
- Platform
- Windows
I already have a macro that has a save function I will list it below, but what I want to happen is I want it to count up every time I save. For example I hit my save macro and it makes a file in my intended loaction but the file name is example.1 then the next time I hit the macro it will save but the file will be saved as example.2 and so forth. Is this possible?
Thank you for your help in advance!
Thank you for your help in advance!
VBA Code:
Sub test()
Dim path As String
Dim filename1 As String
path = "C:\CSV\"
Application.DisplayAlerts = False
ThisWorkbook.Sheets("Data").Copy
filename1 = "Schedulecsv"
Application.DisplayAlerts = True
ActiveWorkbook.SaveAs filename1, FileFormat:=62, CreateBackup:=False
ActiveWorkbook.Close
VBA.MsgBox "Saved'"
End Sub