A
Alok
Could u plz tell me how to restrict/disable the user from switching to the
VBA Macro Code.
Any help would be much appreciated .
VBA Macro Code.
Any help would be much appreciated .
Peter said:You can password-protect your macros by right-clicking on the Project, choosing "Properties", flipping to the "Protection" tab, checking "Lock project for viewing", and entering a password.
That won't disable Alt+F11, but it will hinder the user from viewing your code.
To "turn off" Alt+F11, I suppose you could bind that key combination to an empty macro:
Call Application.KeyBindings.Add(wdKeyCategoryMacro, "Module1.EmptyMacro", BuildKeyCode(wdKeyAlt, wdKeyF11))
hth,
-Peter
Thanx Peter .
Great job.
fumei said:Excuse Peter, but you state "that will not disable Alt-F11".
Hmmm, I suspect you did not actually try it. The code DOES disable Alt-F11,
it also disables Tools > Macro > Visual Basic Editor.
Sub ViewVBCode()
Msgbox "Sorry, you can't do that."
End Sub
will permanently disable opening the VBE. Alt-F11 will just give the
message. Tools > Macro > Visual Basic Editor will give the message. I would
say that effectively disables getting at code. Or perhaps there is a
different meaning to disable that I do not understand. Which is very
possible. However, the actual Word Command to open the VBE is...wait for
it...ViewVBCode.
Yes, if you are very very good, you can hack your way. However if you put
it in the ThisDocument module, I suggest you add a logic loop if you ever
want to see the code again.
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.