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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,216,113
Messages
6,128,905
Members
449,477
Latest member
panjongshing

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