Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim cbWSMenuBar As CommandBar
On Error Resume Next
Set cbWSMenuBar = Application.CommandBars("Worksheet menu bar")
cbWSMenuBar.Controls("Tool Menu").Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not SaveAsUI Then Exit Sub
Cancel = True
End Sub
On Error GoTo ErrorHandler
Dim FileName As String
FileName = Application.GetSaveAsFilename(FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
If FileName = "False" Then Exit Sub
Application.EnableEvents = False
ThisWorkbook.SaveAs FileName:=FileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
ErrorHandler:
Application.EnableEvents = True
That is not a guarantee, because the user can choose the same name.to force SaveAs so that the template is never written over
Yes, but be sure you OPEN the template instead of NEW'ing it.I 'm going to try changing it to a template file, assuming I just then save with the same name to update it with changes I may make?