Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Excel Errors / May 2005

Tip: Looking for answers? Try searching our database.

run-time error 9

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LHearn - 27 May 2005 22:00 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.