Excel 2010 Worksheet Protect method

S

Stan Brown

I have a workbook developed in Excel 2003. Now in Excel 2010 my
Workbook_Open macro is getting error 1004, Application-defined or
object-defined error. The line that the debugger points to is

Worksheets("Attendance").Protect Contents:=True

Was there some change in Excel 2007 or 2010 that invalidated the
above? From reading Excel 2010 help it sure looks like the above is
still valid.

Yes, I really do have a worksheet called "Attendance". (In the
immediate window I typed ?worksheets("attendance").name and it
responded Attendance.) Macros are enabled for the location where
this workbook lives. The workbook isn't read-only.

What's especially weird is that I have this line in a macro that is
tied to Ctrl-Shift-R:

ActiveSheet.Protect Contents:=True

and it works just fine.

I'll be very grateful if someone can tell me what's wrong and how to
fix it.
 

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