Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if workbook protected?

Status
Not open for further replies.

ninjamyst

Programmer
Jan 28, 2005
21
US
Hi,

I have a macro to add a new worksheet template to a workbook. However, if the workbook is protected, an error occurs. How can I check if an opened workbook is protected? I have tried workbook.haspassword and workbook.password but they don't correspond to the protection of the workbook. I have some workbooks that are protected but workbook.haspassword returns false; I have some workbooks that are not protected but workbook.password returns an actual string. Thanks.
 
Hi.

Look at the Workbook.ProtectStructure and ProtectWindow Properties

Skip,

[glasses] [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering...
"Is there really a DOG?" [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top