View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Henk Henk is offline
external usenet poster
 
Posts: 80
Default Runtime error 57121

Thanks for your quick answer Paul, but the password is the same on all sheets
of my workbook.

I deleted the entire Sub Workbook_open() and reinserted the simple procedure :

Sub Workbook_open()

Sheets("Sheet1").Unprotect Password:="mypassword"

End Sub

I got the same error when I opened the workbook.

Regards,

Henk


" wrote:

Hi
Does that sheet have that password? Check there isn't a leading or
trailing space in the sheet password.

regrds
Paul

On Feb 25, 11:17 am, 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?