protect workbook

E

eugene

Hi,

I would like to protect the structure of a workbook.

I have tried

ActiveWorkbook.Protect Password:=pword, Structure:=False
ActiveWorkbook.Protect (pword, True)

(where pword is a variable defined earlier)
and various other combinations.
I get a compile error in all cases - "Expected: ="

What am I doing wrong?

Eugene
 
E

eugene

Problem solved.

My password variable was a number which was not being accepted by
Activeworkbook.Protect. Changed it to a string using Cstr(pword) and it works.

Strange thing is that I used the same logic and commands to protect the
sheets in the workbook. ActiveSheet.Protect Password:=pword works when the
pword is an integer or other number.

Quite quirky if you ask me.

Eugene
 

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