Problem : Disable design mode in excel file for file security

Problem : Disable design mode in excel file for file security

So I have a excel file accessed by multiple people. Data security is an issue. Generally, from the ‘main’ page most users click on their name (button) and then enter a password (msgBox) to access their respective sheet.

I have noticed that, for kicks, if I act as a user *might* and click the design mode button the macro code is disabled. So I see 2 potential problems:

1. The user cannot properly use functionality dependent on macro code.
2. The active user saves and closes the file. Another user can open the file and choose the ‘disable macros’ options. Now they view the file as it was when the file was exited in design mode.

Both problems can be solved by closing and re-opeing file and enabling the macros since I have a Workbook_Open method to reset the file to the initial ‘main’ worksheet. Problem is, the macros can be disabled as explained in #2. Moreover, even when the ‘enable macros’ option is selected, the screen hangs for a good 4-6 seconds before the macro code resets it to the ‘main’ page. Suppose that this is not acceptable.

Am I alone in this general problem? Basically, how do you make a multi-accessed excel file as secure as possible in MS Excel considering the potential actions of users. Obviously, I’m not trying to combat password cracking software. But I think this problem should be avoidable. Thanks for any help!


Solution : Disable design mode in excel file for file security

Assuming Macros are enabled (for functionality) this will kill the design mode toolbar when you open your Workbook and restore it, of course, on close. Small help, I suspect .

Put this in the ThisWorkbook module:

Private Sub Workbook_Open()
Application.CommandBars(“Control Toolbox”).Enabled = False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(“Control Toolbox”).Enabled = True
End Sub