I am writing a macro and I need to disable the save function on the workbook that VBA has copied and pasted all the information into. Is this possible?
VBA 1: disable the Save & Save As options in Excel In the opening Save As window, select a folder to save the workbook, name the workbook as you need and select Excel Macro-Enabled Workbook from the Save as type drop-down list, and finally click the Save button.
VBA Code: To block the SaveAs dialog box prompt from showing, you simply need to toggle off the Display Alerts application setting prior to using the SaveAs command.
Restrict changes in Excel For more protection options, click File > Protect Workbook.
You can use the Workbook_BeforeSave event to achieve this, disabling the CommandBars won't stop your users using a shortcut such as CTRL + S.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "You can't save this workbook!"
Cancel = True
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With