Problem with Workbook Protection Excel 2007

R

Raj

Hi,

I have the following code in a module:
Sub ProtectWorkbook()
ThisWorkbook.Protect Structure:=True, Windows:=False, password:="xxxx"
End Sub

When I run this, the workbook remains unprotected. I am using Excel
2007. Am I doing anything wrong?

(I tried running through the code using F8. It runs but the workbook
remains unprotected).

Thanks in advance for the help.

Regards,
Raj
 
R

Raj

Hi,

I have the following code in a module:
Sub ProtectWorkbook()
ThisWorkbook.Protect Structure:=True, Windows:=False, password:="xxxx"
End Sub

When I run this, the workbook remains unprotected. I am using Excel
2007. Am I doing anything wrong?

(I tried running through the code using F8. It runs but the workbook
remains unprotected).

Thanks in advance for the help.

Regards,
Raj

Hi,

I was wrong. The workbook is indeed protected. The confusion arose
because when the worksheet is protected, the icon under Review Tab,
becomes "Unprotect Worksheet", whereas it remains the same viz.
"Protect Workbook" in case of a Workbook. I was wrongly assuming that
the workbook was not protected going by this icon.

Regards,
Raj
 

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