Hey folks,
I have the following code in Workbook_BeforeSave, disabling all saving:
Private Sub Workbook_BeforeSave(ByVal SaveUIAs As Boolean, Cancel As Boolean)
Cancel = True
End Sub
I then have the following code in a module associated to a Save & Exit button, allowing the user to save and rename the file:
Sub Save_Exit()
Answer = MsgBox("This will save your current session and exit." & vbNewLine & vbNewLine & "Do you wish to continue?", vbOKCancel + vbInformation)
If Answer = vbCancel Then Exit Sub
Application.Dialogs(xlDialogSaveAs).Show
Application.Quit
End Sub
I also have the following code allowing the user to save and overwrite the existing spreadsheet unless it is the template:
Sub Save()
If ThisWorkbook.Name = "Ad Schedule (Template).xlsm" Then
Answer = MsgBox("Please rename this Template before saving your changes.", vbOKCancel + vbInformation)
If Answer = vbCancel Then Exit Sub
Application.Dialogs(xlDialogSaveAs).Show
Else
Answer = MsgBox("This will save your current session and overwrite the existing file." & vbNewLine & vbNewLine & "Do you wish to continue?", vbOKCancel + vbInformation)
If Answer = vbCancel Then Exit Sub
ThisWorkbook.Save
End If
End Sub
I have a couple of questions:
- How do I re-enable saving for these two buttons?
- Is it possible to completely grey out the Save As and Save buttons?
Thanks in advance!
Bookmarks