I have a VBA script in place so that if a cell is blank then Excel will prompt the file to be saved.
This is ensure that the template is not altered. However, when the user clicks save in the "Save As" dialogue box, the file does not save.
This is the code I am using:
If Worksheets("Input").Range("E2").Value = "" Then
Application.EnableEvents = False
Application.GetSaveAsFilename InitialFileName:="\\ac35542\Problem Management\Action Plans\ChangeMe.xlsm", FileFilter:="Excel Macro-Enabled Workbook (*.xlsm),*.xlsm"
Application.EnableEvents = True
MsgBox "Please ensure fill in the Problem Reference Number, Problem Title, and Select a Contract", vbExclamation, "PR Reference & Title"
Worksheets("Input").Select
Range("E2").Select
End If
Why is the file not saving?
GetSaveAsFilename
just returns the path and filename that the user selected: it doesn't actually do any saving. You have to callSaveAs
if you want to save the file. – Tim WilliamsApplication.Dialogs(xlDialogSaveAs).Show
– Tim Williams