Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Disable ALT+F11

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alok - 23 Dec 2004 13:13 GMT
Could u plz tell me how to restrict/disable the user from switching to the
VBA Macro Code.

Any help would be much appreciated .
Peter - 23 Dec 2004 19:02 GMT
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

> Could u plz tell me how to restrict/disable the user from switching to the
> VBA Macro Code.
>
> Any help would be much appreciated .
fumei - 23 Dec 2004 19:33 GMT
Check out a file called 'override.zip" from Microsoft.  It has a .DOT file
showing how to disable ALL Word commands.

WARNING!!!!!!!  Do not open the file unless you have the VBE OPEN.  All
commands in the file are disabled, including all closing commands.  In other
words, unless you have the VBE open in order to release the closing commands,
you can NOT close the file!

Sub ViewVBCode()
   'Overrides Alt+F11
   MsgBox "ViewVBCode"
End Sub

Pressing Alt-F11 will display the message "ViewVBCode"...the VBE will not
open.

> 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.
[quoted text clipped - 10 lines]
> >
> > Any help would be much appreciated .
Peter - 23 Dec 2004 19:58 GMT
Couldn't find "override.zip", but that sub seems marginal.  Too easy to get around: just open Word, Alt+F11, then open the document whose VBA code you want to view.  If the sub is in a global addin, it makes it a tiny bit harder, but you can just disable the addin, close and re-open Word.  It might work better in conjunction with other methods.

-Peter

> Check out a file called 'override.zip" from Microsoft.  It has a .DOT file
> showing how to disable ALL Word commands.
[quoted text clipped - 26 lines]
> > >
> > > Any help would be much appreciated .
Helmut Weber - 24 Dec 2004 08:13 GMT
Hi Peter,
couldn't try out til now, whether this is
the right "override.zip", but could be:

http://catamaran.labs.cs.uu.nl/twiki/pt/bin/view/Transform/
DeFeater

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Peter - 27 Dec 2004 19:20 GMT
That looks like the same "override.zip" that I found via google: it obfuscates VB code so that it's more difficult to decompile.
Since it seems to apply only to compiled VB code (I couldn't inspect the file because the download "does not appear to be a valid archive"), it won't help protect VBA projects.
I'm not particularly interested in it; I was just trying to help Alok protect VBA projects.

-Peter

> Hi Peter,
> couldn't try out til now, whether this is
[quoted text clipped - 7 lines]
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
Alok - 28 Dec 2004 05:05 GMT
Thanx Peter .
Great job.

> 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.
[quoted text clipped - 10 lines]
> >
> > Any help would be much appreciated .
Jean-Guy Marcil - 28 Dec 2004 16:32 GMT
Alok was telling us:
Alok nous racontait que :

> Thanx Peter .
> Great job.

Just keep in mind that whatever method you choose, it will easily be
bypassed by anyone who wants to and who has access to an Internet search
engine if he/she does not really know how.

VBA code to de-allocate ALT-F11 will not work when Word security is set to
high... Then none of the code will work, but anyone can read the projects.

Setting a password is really no real security.... This is one of the easiest
password to crack...

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

fumei - 04 Jan 2005 22:01 GMT
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.

> Alok was telling us:
> Alok nous racontait que :
[quoted text clipped - 11 lines]
> Setting a password is really no real security.... This is one of the easiest
> password to crack...
Peter - 04 Jan 2005 23:56 GMT
> Excuse Peter, but you state "that will not disable Alt-F11".

I did state that, but about password-protecting the project, not about ViewVBCode.

> Hmmm, I suspect you did not actually try it.  The code DOES disable Alt-F11,
> it also disables Tools > Macro > Visual Basic Editor.

Hmmm, yes I did actually try it, and my comment was that it's too easy to get around.

> Sub ViewVBCode()
> Msgbox "Sorry, you can't do that."
[quoted text clipped - 6 lines]
> possible.  However, the actual Word Command to open the VBE is...wait for
> it...ViewVBCode.

Why so insistent and condescending over such a minor issue?

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

(Un)fortunately, I'm not "very very good"  when it comes to hacking Word, and I found it trivial to bypass.

Jean-Guy Marcil put it well:

> > Just keep in mind that whatever method you choose, it will easily be
> > bypassed by anyone who wants to and who has access to an Internet search
[quoted text clipped - 5 lines]
> > Setting a password is really no real security.... This is one of the easiest
> > password to crack...

hth,

-Peter
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.