Protecting a VBA project

Lynnette

New Member
Joined
Apr 1, 2009
Messages
7
I need to password protect a VBA project. This is being done internally and the people with the password will be within the office. How do I do the protect. The worksheets will be password protected, but in order to perform sum of the operations the worksheets will be unprotected and then reprotected. We are trying to protect the password that will be in the documentation in the macro.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi,

Open up the visual basic editor (Alt+F11) and make sure you have your project selected in the project explorer window.

Then go Tools | VBAProject Properties | Protection Tab
Tick the lock project for viewing checkbox
Enter in the password.

You'll only see the protection take effect once you have Saved + Closed + Reopened the file.


By the way, do the worksheets need to be unprotected to do this sum?
 
Upvote 0
try this

Code:
ActiveSheet.Protect password:="anystring"

Code:
ActiveSheet.Unprotect password:="anystring"
 
Upvote 0
Hi,

Open up the visual basic editor (Alt+F11) and make sure you have your project selected in the project explorer window.

Then go Tools | VBAProject Properties | Protection Tab
Tick the lock project for viewing checkbox
Enter in the password.

You'll only see the protection take effect once you have Saved + Closed + Reopened the file.


By the way, do the worksheets need to be unprotected to do this sum?

Yes, they do.
 
Upvote 0
If you say so, Lynette. :)

If you have any more questions or problems regarding protecting the VBA project then let us know.
 
Upvote 0
Hi, I need to protect a VBA project programatically (ie with code). Anyone has any helpful sugestions?
The problem is that when I programatically copy the worksheets to a new workbook and save that workbook "as" the saved version's code contained in the worksheets is not protected even thought the original project is, allowing user to interfere with it.
Many thanks
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,688
Members
448,978
Latest member
rrauni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top