This code below works, but it closes out the original active workbook. I'd like to keep the original active workbook open so I can do some further VBA code processing.
Code: Select all
Sub SaveAsBackup() Dim FName As String: FName = Left(ThisWorkbook.Name, (InStrRev(ThisWorkbook.Name, ".", -1, vbTextCompare) - 1)) Dim FPath As String: FPath = ActiveWorkbook.Path & Application.PathSeparator Dim strDate As String: strDate = Format(Now, "mmm-yyyy") Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:=FPath & FName & " - " & strDate & ".xlsx", FileFormat:=51 Application.DisplayAlerts = True End Sub