MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Disabling VB Editor


Posted by Geoff on August 04, 2000 6:14 AM

I am writing an interface in using VBA in Excel. When it's finished, I want to disable the ability of the user to go into the VB Editor and change my code. I wasn't sure how to go about doing this. Thanks for any help.

Geoff


Posted by JAF on August 04, 0100 8:15 AM

You can lock the VB Editor with a password by doing the following:
From the Tools menu, select VBAProject Properties. On the Protection tab, tick the Lock Project for Viewing checkbox, enter and confirm your password (case sensitive).

When you've saved, closed and re-opened your workbook, the VB code will be locked.

HOWEVER - there are a number of software products which can easily crack your password, so your code isn't guaranteed safe, but the above will hide it from the prying eyes of casual users.