I found this Excel code on the internet. It works fine. However there is a problem with the code. When I run the code a second time, I get a message that says I cannot save this workbook with the same name. Is there a code that I can use that can override the Workbook named Marios sales results. Or instead of adding a workbook is there a way to call a workbook on the 4th line of code??? Thanks
Sub SaveAsMariosSalesResults()
Application.DisplayAlerts = False
ThisFile = Sheets("Commission Table").Range("V16").Value
Set wb = Workbooks.Add
ThisWorkbook.Activate
Sheets("Mario").Copy Before:=wb.Sheets(1)
wb.Activate
wb.SaveAs Filename:=ThisFile, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
Sub SaveAsMariosSalesResults()
Application.DisplayAlerts = False
ThisFile = Sheets("Commission Table").Range("V16").Value
Set wb = Workbooks.Add
ThisWorkbook.Activate
Sheets("Mario").Copy Before:=wb.Sheets(1)
wb.Activate
wb.SaveAs Filename:=ThisFile, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub