Getting this error on below code:
VBA Code:
Private Sub CommandButton1_Click()
Dim Path As String
With CreateObject("Scripting.FileSystemObject")
ActiveSheet.Name = "Data ~ " & Format(Now(), "MM.dd.yy")
End With
MyName = ActiveSheet.Name & " - " & Format(Now(), "hh.mm.ss am/pm")
'MyName = ActiveSheet.Range("B2").Value
Const csPath As String = ThisWorkbook.Path & "\" 'Same path as this file location.
Application.DisplayAlerts = False
ActiveWorkbook.SaveCopyAs Filename:=csPath & MyName & ".xlsm"
Application.DisplayAlerts = True
End Sub