+ Reply to Thread
Results 1 to 4 of 4

How do I hide the "View Code" menu option?

  1. #1
    Registered User
    Join Date
    04-19-2012
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003/ Excel 2007
    Posts
    2

    Question How do I hide the "View Code" menu option?

    Hi, I'm trying to complete a non-destructive way of protecting the VBE from 'clever' users (i.e. not using VB code to set/unset the VBProject password).

    I have disabled the Macro menu option and the [Alt]F11 shortcut :-

    CommandBars("Worksheet Menu Bar").Controls("Tools").Controls("Macro").Enabled = False

    Application.OnKey "%{F11}", "Msg" ("Msg" Sub opens a MSGBox to inform user they have no access to the option)

    but so far have not been able to disable the Right Click "View Code" option under the Excel icon on the left of the "Worksheet Menu Bar" Toolbar.

    Any ideas welcome please...

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How do I hide the "View Code" menu option?

    AMH209,

    Wouldn't you just put a password on the VBAProject? In the VBE (Visual Basic Editor), right click on the VBAProject, by default it's named VBAProject (Workbook Name), and select "VBAProject Properties" -> Go to the Protection tab -> Select "Lock project for viewing" -> Enter and confirm a password -> OK

    That way, when the Visual Basic Editor is opened and the code in that VBAProject is attempted to be viewed in any way, the user will get prompted for that password.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-19-2012
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003/ Excel 2007
    Posts
    2

    Re: How do I hide the "View Code" menu option?

    Hi, I would except that I have to be able to remotely do patch updates to the modules from another workbook, so don't want to even think about using code to unprotect and protect the VBProject - from what I have read this is unreliable at best. So I am looking at other ways to prevent the users from accessing the code, whilst not preventing me from doing my patches. (The user community is both 'VBA aware' and located very remotely at disparate locations.). Removing their ability to click through to the VBE is good enough.

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How do I hide the "View Code" menu option?

    Not much good any amount of code is going to do if they simply disable macros... Then they could just enter the visual basic editor normally.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1