When I run the following code, I get a run-time error 9 message. Does anyone
have any ideas? we are trying to make a new timecard program for our
employees and this macro was working just fine yesterday. The code is
designed to unprotect the sheet in the workbook, spell-check it, then
re-protect the sheet. Any assistance is much appreciated.
' Keyboard Shortcut: Ctrl+s
'
Windows("2005 Master Timecard.xls:2").Activate
ActiveSheet.Unprotect Password:="bear"
Range("G1:G70").Select
Selection.CheckSpelling SpellLang:=1033
ActiveSheet.Protect Password:="bear"
End Sub
Rob Bovey - 27 May 2005 23:54 GMT
Try changing the line:
Windows("2005 Master Timecard.xls:2").Activate
to this:
Workbooks("2005 Master Timecard.xls").Activate
Note the use of the Workbooks method rather than the Windows method and the
removal of the Window counter from the end of the workbook name.

Signature
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/
* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
> When I run the following code, I get a run-time error 9 message. Does
> anyone
[quoted text clipped - 11 lines]
> ActiveSheet.Protect Password:="bear"
> End Sub
JMB - 30 May 2005 19:24 GMT
Also, ensure Master Timecard workbook is open (unless you have code that
automatically opens it) and make sure the workbook name has not changed.
Somtetimes people change the workbook name w/o updating the code to reflect
the new name.
> When I run the following code, I get a run-time error 9 message. Does anyone
> have any ideas? we are trying to make a new timecard program for our
[quoted text clipped - 10 lines]
> ActiveSheet.Protect Password:="bear"
> End Sub