M
Mark
I currently have a macro that, before it runs, the save as menu automatically
comes up and asks the user to save his/her current data. However, I do not
know how to code anything to cancel the process.
Currently, if the user saves or not, the macro automatically continues. I
want the user to be able to choose between saving or not... but then be
prompted to continue running the macro or opt out.
My code, as it stands, is as follows....
Sub BackUp_Save()
Dim SaveName As Variant
Dim fFilter As String
Dim NewName As String
MsgBox "You are about to delete all data within the model. Saving is
suggested."
NewName = "Model BackUp"
fFilter = "Excel Files (*.xls), *.xls"
SaveName = Application.GetSaveAsFilename _
(NewName, fileFilter:=fFilter)
If SaveName = False Then
'use cancelled--what to do?
Else
ThisWorkbook.SaveAs Filename:=SaveName, FileFormat:=xlWorkbookNormal
End If
MsgBox "The model will now perform a refresh. Please wait."
End Sub
comes up and asks the user to save his/her current data. However, I do not
know how to code anything to cancel the process.
Currently, if the user saves or not, the macro automatically continues. I
want the user to be able to choose between saving or not... but then be
prompted to continue running the macro or opt out.
My code, as it stands, is as follows....
Sub BackUp_Save()
Dim SaveName As Variant
Dim fFilter As String
Dim NewName As String
MsgBox "You are about to delete all data within the model. Saving is
suggested."
NewName = "Model BackUp"
fFilter = "Excel Files (*.xls), *.xls"
SaveName = Application.GetSaveAsFilename _
(NewName, fileFilter:=fFilter)
If SaveName = False Then
'use cancelled--what to do?
Else
ThisWorkbook.SaveAs Filename:=SaveName, FileFormat:=xlWorkbookNormal
End If
MsgBox "The model will now perform a refresh. Please wait."
End Sub