VBA Save file as new name

D3allamerican07

Board Regular
Joined
Jul 22, 2015
Messages
101
I have a macro that opens several files, calls a macro, and needs to be able to save the file as a new name once fixed. The code I need should notify the user they are about to save the file with a new name if an error was found.

Code:
If Sheets("ErrorSheet").Range("A2") = "" Then
    MsgBox "There were no errors found on this template. Do you want to save the file as: " & myFile, vbYesNo + vbQuestion, "Save File"
    'Save and Close Workbook
      wb.Close SaveChanges:=True
ElseIf Sheets("ErrorSheet").Range("A2") <> "" Then
    MsgBox "Errors were found on this template. Do you want to save the file as: " & myFile, vbYesNo + vbQuestion, "Save File"
    wb.SaveAs myPath & & "(ERRORS_FOUND)" & myExtension)
    wb.Close 
End If
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,356
Messages
6,124,471
Members
449,163
Latest member
kshealy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top