Enable code in a password protected worksheet

B

Barattolo_67

I have a spreadsheet that contains some VBA code linkled to some combo boxes.
I have digitally certified the file, so that I can run the code without
getting a warning once I open it. All works fine: I can open the file, and
use the combo boxes and the code beyound them.

Now, the problem is that I need to password protect this file. Once I put a
password to it, the code and the combo boxes do not work any more. When I
open the file, I am asked to enter the password, I put in the correct one,
the file opens correctly, but the combo boxes (and the code beyond them) do
not work.

Any ideas?

Thanks
 
A

Alan

Wrap your code with:-

Sheet1.Protect ("password")

'Your code here

Sheet1.Unprotect ("password")

or

Sheets("Sheet1").Protect("password")

Adjust the sheet name and password to suit

Regards,
Alan.
 
B

Barattolo_67

Alain,

Thanks for this, but this is not what I need. I need Excel to ask the user
to enter a password before he/she can open the file at all. If the user
enters the right password, then the worksheet should open up and the codes
and the combo boxes should be enabled.

Best regards.
 

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

Top