We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
What I would like to be able to do is when the user exits using the exit button is to save this as “Consolidated ” & Range(“R2”) where Range (“R2”) is the name of the project. If there is a workbook already named as “Consolidated “ & Range(“R2”) then the user has the option to replace (overwrite) old file with new.
Sub ExitExcel() '******* New Project Start ******* 'ActiveWorkbook.Close If ThisWorkbook.Name = "Consolidated.xlsm" Then If Application.ActiveWorkbook.Saved = False Then If Trim(Sheets("Consolidated").Range("R2").Value) = "" Then If MsgBox("You have changed the 'Consolidated' template and you have not assigned a Project Name." & vbCrLf & vbCrLf _ & "Click 'Yes' to assign a Project Name." & vbCrLf _ & "Click 'No' to close the workbook without saving the changes.", vbCritical + vbYesNo, "Template Changed") _ = vbYes Then NewProject Exit Sub Else Application.ActiveWorkbook.Saved = True ActiveWorkbook.Close SaveChanges:=False Exit Sub End If End If End If End If ActiveWorkbook.Close '******* New Project End ********* End Sub
Join the community of 500,000 technology professionals and ask your questions.