Use the following macro code mentioned below. This macro will disable the Save As option in Excel. This macro prevents Saving under a different name or in a different location.
Code:
Private Sub Workbook_BeforeSave _
'This macro disables the "Save As" Feature in Excel
'This means that a user will not be able to save this
'workbook(file) under a different name or in a different location
'
'This MUST be placed in "ThisWorkbook" and NOT in a Module.
'
(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then Cancel = True
End Sub
To use this Macro -
- Press Alt + F11 - to open the Visual Basic Window
- Locate the open excel file in the left pane of the window and double click "ThisWorkbook."
- Paste this code In the window that opens.
- Save and close the Visual Basic Window.
Note -
This macro runs in "ThisWorkbook" and not in a Module.
Putting the code there instead of inside a module is what will allow this code to run automatically before excel saves or closes.
Bookmarks