LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Runtime error 57121

Try qualifying the worksheets:

For Each WkSht in Worksheets
becomes:
For Each WkSht in Me.Worksheets




Henk wrote:

To unprotect my entire workbook on opening, I start on ThisWorkbook the
following procedure :

Private Sub WorkBook_Open()
Application.ScreenUpdating = False

For Each WkSht in Worksheets
WkSht.Unprotect Password:="mypassword"
Next WkSht

I have a lot of workbooks with this procedure fuctioning properly, however
there is one which each time results in Runtime error 57121 :
Applikcation-defined or object-defined error. Debugging points me to the line
: WkSht.Unprotect Password:="mypassword"

(In the same workbook I have a macro, using the same code, wich is working
without errors.)

Any idea how to solve this?


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
xpath error? Runtime Error 13 type mismatch Steve M[_2_] Excel Discussion (Misc queries) 0 January 17th 08 01:16 AM
xpath error? Runtime Error 13 type mismatch SteveM Excel Discussion (Misc queries) 1 December 4th 07 09:16 AM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Runtime Error 9 Lizz45ie Excel Discussion (Misc queries) 1 May 27th 05 08:44 PM


All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"