Archive of Mr Excel Message Board
ActiveSheet.Unprotect password:=""
.
.(data Input to workbook procedure here)
.
Workbooks(ThisBook).Worksheets(1).Activate
ActiveSheet.Protect
...this works fine in excel 2000 but trips up on the last line (AciveSheet.Protect)in excel 97???
can anyone help and tell me if theres a way to accomplish unprotecting/ protecting the workbook for data access purposes that will work across both softwares?
Thanks,
Chris

| Check out our Excel VBA Resources | ||||
![]() |
![]() |
![]() |
![]() |
![]() |
Morning,
The line Activesheet.Protect will work fine in XL97 or XL2000. In your code you've used this line :-
Workbooks(ThisBook).Worksheets(1).Activate
Is ThisBook defined as a string and does it have the name of the workbook attached to it? You could replace your code with this:-
ThisWorkbook.Worksheets(1).Protect
HTH,
Dax.

Dax -
Thanks -
Found the problem - the wbook was not ever getting opened (it seems that cbo.text is not updated the same in excel 97 as it is in 2000 guess???)
-Chris
