How to disable VIEW CODE in the tab of a workbook

  • Thread starter Thread starter Marcello do Guzman
  • Start date Start date
M

Marcello do Guzman

I hope someone can help me with this. I have been able to disable the
shortcut keys to prevent people from viewing my macros, running the
macro editor, added password to my macros and so fort, but need to
find a way to hide or disable people from right clicking on the tab
and viewing the VIEW CODE selection. How can I grey this out?
Please email with answer at:

(e-mail address removed)

thanks in advance
 
This really isn't likely to do you any good since any VBA solution you
come up with can be defeated by opening your workbook with macros
disabled.

However, you can do it using:

Application.CommandBars("Ply").Controls("View Code").Enabled = False

Even with macros enabled, a sufficiently clever person might bypass this
by creating a toolbar with the View Code or Visual Basic Editor control
button on it. I normally replace the standard toolbar with one I create
that has a button like that.
 
Correct for wordwrap:-
Application.CommandBars("Ply").Controls("View
Code").Enabled = False 'True to enable again

Regards,
Greg
 
And can you please share your knowledge, how have you been able to disable
the shortcut keys for viewing macros?
 
When you password protected the project, didn't that stop the user from seeing
your code?

If it didn't, then maybe you didn't check the:
"lock project for viewing"
under tools|VBAProject Properties|General Tab
 
One way:

Application.OnKey "%{F11}",""

though, since nearly all shortcut keys are fully customizable (at least
in MacXL), there's no guarantee that this is the, or the only, keyboard
shortcut for viewing macros.
 
Back
Top