Why this 1004 Error message?

S

Stuart

A simple routine which starts as:

With ActiveWorkbook.Worksheets("Master CVI")
.Unprotect Password:="SGB"
.Cells.Locked = False

(code now works with just this sheet, and finally
protects it, before closing the With statement)

'Protect the sheet
.Protect Password:="SGB"
.EnableSelection = xlUnlockedCells
End With

I now immediately say:

'Protect the workboook
ActiveWorkbook.Protect Password:="SGB"

End Sub

and it's on this last line that the error is raised.

Why so, please?

Regards.
 
D

Dave Peterson

I could get a 1004 error message if the workbook were already protected with a
different password.
 
S

Stuart

That was my error.

Regards and thanks.

Dave Peterson said:
I could get a 1004 error message if the workbook were already protected with a
different password.
 

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