SOLVED

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

Copper Contributor

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 sheet to be visible and save, save as options should be disabled. while closing, I want the sheet to be again hidden so that next time opens it will ask the user to enable it ... 

 

 

2 Replies
best response confirmed by imsureshbio1109 (Copper Contributor)
Solution

@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.

Thanks. It works like a charm satisfy my needs.
1 best response

Accepted Solutions
best response confirmed by imsureshbio1109 (Copper Contributor)
Solution

@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.

View solution in original post