Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 20
Default Locking Macros from being edited, but not viewed.

The idea is to lock a macro so it cannot be changed, but can still be viewed. Some of the higher-ups don't appreciate my protection.
Thanks,
Pistolade
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,514
Default Locking Macros from being edited, but not viewed.

The idea is to lock a macro so it cannot be changed, but can still be
viewed. Some of the higher-ups don't appreciate my protection.
Thanks,
-Pistolade-


Unfortunately Excel's VBProject protection scheme isn't that granular.
If users can see it then they can also modify it!

What I do for myself is my projects disable any/all ways to access the
VBE and build a mechanism into them that enables me 'developer' access
to the VBE based on a specific file being located in the same path as
the Excel file. This file contains encrypted project-specific info so
it can't be copied/used with other projects. My projects use this to
configure UI settings at startup so they know which built-in menus and
keyboard shortcuts to disable for normal users.

This might be a more complex solution than you're looking for, though!

Another approach is to 'hook' all UI actions that target access to the
VBE to require a username:password login to enable. As stated earlier,
though, this will allow viewing/modifying unlocked projects.

Finally, you could implement a mechanism that prints or displays your
code based on user login. This involves getting the 'Current User' via
something like...

If InStr(1, sAllowedUsers, Environ("username")) 0 Then
'print or display the code
End If

...which you can manage via a simple button (or menuitem if your project
creates its own menus/toolbar).

HTH

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default Locking Macros from being edited, but not viewed.

On Thursday, May 1, 2014 4:02:42 PM UTC-5, Pistolade wrote:
The idea is to lock a macro so it cannot be changed, but can still be

viewed. Some of the higher-ups don't appreciate my protection.

Thanks,

-Pistolade-

You could just copy the code to a worksheet for viewing.. You could even protect the sheet so they couldn't even change there. Or, let them change for you to change the real code accoringly







--

Pistolade


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking Macros ranswrt Excel Programming 5 August 3rd 08 12:36 AM
Can macros be viewed or edited while in shared mode in Excel 2007? palzie Excel Programming 1 March 9th 07 11:11 PM
locking tabs w/macros erik Excel Discussion (Misc queries) 2 July 6th 05 05:21 PM
Locking Code In Individual Macros Carl Bowman Excel Discussion (Misc queries) 2 May 19th 05 06:05 PM
Protecting my macros from being viewed/edited? No Name Excel Programming 1 August 27th 04 01:21 PM


All times are GMT +1. The time now is 09:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"