How To Disable Or Do Not Allow Save & Save As Options In Excel?


The effective spreadsheet programme Excel is used frequently for data management, calculations, and analysis. To maintain data integrity or safeguard sensitive information, you might want to restrict users from saving or making copies of a particular Excel file in some circumstances. You can manage how the file is used and prevent unauthorised alterations or dissemination by using the instructions in this tutorial to deactivate or limit the "Save" and "Save As" options. These methods will assist you in enforcing the proper level of security within your Excel environment, regardless of whether you are working on a shared document, an important report, or a confidential file.

Please be aware that the techniques covered in this article may entail changing settings or using VBA (Visual Basic for Applications) code and that they call for administrative capabilities. Before enforcing these limits, it is essential to make a backup of your Excel files so that you may undo any modifications if necessary. Let's go on and investigate the many methods for limiting or disabling the "Save" and "Save As" options in Excel so that you have more control over your spreadsheet files.

Disable Or Do Not Allow Save & Save As Options

Here we will first insert VBA code to disable the save option, then add another code to the same sheet to disable the save as option. So let us see a simple process to know how you can disable or not allow Save and Save As options in Excel.

Step 1

Consider any Excel.

First, right−click on the sheet name and select "View Code" to open a VBA application. Then, double−click on this workbook and copy the below code into the textbox.

Right click > View code > Double click > Copy.

Code

Private Sub Workbook_BeforeClose(Cancel As Boolean)
   ThisWorkbook.Saved = True
End Sub

Step 2

Then click on "Save" and save the sheet as a macro−enabled template. To do so, click on Save, choose the destination, select Type as macro−enabled template, and click OK.

Step 3

Now, again in the VBA application, for the This Workbook window, add the below code to the existing code.

Code

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim xName As String
xName = "CancelBeforeSave"

If Not Evaluate("=ISREF('" & xName & "'!A1)") Then
   Sheets.Add(after:=Worksheets(Worksheets.count)).Name = xName & ""
   Sheets(xName & "").Move after:=Worksheets(Worksheets.count)
   Sheets(xName & "").Visible = False
   Exit Sub
End If
   Cancel = True
End Sub

Step 4

Then again, save the sheet and close it. You can see that the sheet is saved with the disable save and save as options.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can disable or not allow Save and Save As options in Excel to highlight a particular set of data.

Updated on: 11-Jul-2023

573 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements