Protecting VBA macro from modification by users

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to prevent users from modifying a VBA macro in Excel. Otherwise, the
sheet should be unprotected. How can I do this? Thanks.

Mike
 
In the vbe, in tools=>vbaProject Properties

there is an option to protect your code.

You should rename your project first (not the workbook name) to something
unique. The default name is vbaProject. Once you do that it will be
tools => YouNewProjectName properties.

You then have to save the workbook and close it. When you reopen it, the
protectin will be applied.
 
You need to get into the VBE (Alt F11) IN the left hansd side you will see a
list of all of the projects currently open. Right Click on the project
(spreadsheet) you want to protect. Select Properties and then select the
protection Tab... Add a Password and Bob's your uncle. One thing to note is
that a protected project will not allow you to enter the debug mode if the
VBA crashes, so you will have to Unprotect it a recreate the error to debug
it...

HTH
 

Ask a Question

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.

Ask a Question

Back
Top