View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
eugene eugene is offline
external usenet poster
 
Posts: 61
Default protect workbook

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



"eugene" wrote:

Hi,

I would like to protect the structure of a workbook.

I have tried

ActiveWorkbook.Protect Password:=pword, Structu=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