How to disable VIEW CODE in the tab of a workbook

  • Thread starter Marcello do Guzman
  • 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
 
J

JE McGimpsey

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

Greg Wilson

Correct for wordwrap:-
Application.CommandBars("Ply").Controls("View
Code").Enabled = False 'True to enable again

Regards,
Greg
 
M

Martyn

And can you please share your knowledge, how have you been able to disable
the shortcut keys for viewing macros?
 
D

Dave Peterson

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
 
J

JE McGimpsey

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top