Forum Discussion

imsureshbio1109's avatar
imsureshbio1109
Copper Contributor
Nov 23, 2022
Solved

I want to disable save and save as options using VBA plus hide the sheet during close

Hi all,  I know this is an old thread, but I am facing problem enabling macros to all the users in my organization. so i want to hide the sheet initially and after enabling the macros i want the she...
  • HansVogelaar's avatar
    Nov 23, 2022

    imsureshbio1109 

    See the attached example workbook.

     

    The VBA code has been protected with password 123. You should change this to a safer one: in the Visual Basic Editor, select Tools > VBAProject Properties... > Protection tab.

     

    If you want to make changes to the workbook and save it, activate the Immediate window in the Visual Basic Editor (Ctrl+G), type the following line and press Enter:

     

    Application.EnableEvents = False

     

    Don't forget to hide the sheet named Hidden before saving the workbook.

    Don't forget to enable events again afterwards:

     

    Application.EnableEvents = True

     

    Warning: this is not watertight. Knowledgeable users will be able to bypass the protections.

Resources