Unable to lock project in Excel VBA

DeFacto

New Member
Joined
Jul 29, 2004
Messages
33
I'm having a curious problem I'm hoping someone can help me with...

When I was using Excel 2003, I would often 'lock' my VBA projects when sharing workbooks with sensitive information... it was especially helpful when I had information on a Very Hidden tab that I didn't want anyone to know about or try to 'Unhide'. However, ever since I've been using Excel 2007 and 2010 I have been unable to lock any projects prior to sharing or distributing. Here are the steps I've been using to try to lock my projects in Excel 2007 & 2010: In the VBA window I highlight the workbook/project I'm interested in locking. I click on 'Tools > VBAProject Properties...' and click on the 'Protection' tab. I mark the box called 'Lock project for viewing' and then provide a password and confirm password. Once done, I either save the workbook from the VBA window or I navigate back to Excel and save the workbook from there. Either way, when I re-open the workbook it's as if I never protected (or tried to protect) the workbook/project.

I'm totally baffled and I've messed around with several workbooks over the past year-and-a-half trying to get this to work. It's not possible this is still a bug Microsoft hasn't fixed in Excel 2007 or 2010 yet, is it? Any help or experience anyone has to offer would be greatly appreciated... I've been pulling my hair out for a long time.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I believe in Excel 2007+, you need to have some code -- any code -- in the workbook in order to protect the project. E.g., in ThisWorkbook,

Code:
Sub MySub()
End Sub
 
Upvote 0
Thanks shg4421,

It worked... many thanks!

However, do you if there is a way to accomplish this without having to save the file as a Macro-enabled workbook (.xlsm)?

Thanks again!
 
Upvote 0
You can't save a macro in anything other than an macro-enabled workbook, so I think not.
 
Upvote 0
I believe in Excel 2007+, you need to have some code -- any code -- in the workbook in order to protect the project. E.g., in ThisWorkbook,

Code:
Sub MySub()
End Sub
after 11 years your answer save me
Thanks
 
Upvote 0

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

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