Excel 2003 protect not working in Excel 97

N

norman1nz

Hi I have created a program that unprotects the reprotects as user
press buttons etc which works fine in Office 2000 and office 2003, bu
the users of the program are still running Office 97, with which th
code returns an error.


This is my general syntax:


Sub ProtectAll()
Sheets("sheet1").Protect
Sheets("sheet2").Protect
Sheets("sheet3").Protect
End Sub


Sub UnProtectAll()
Sheets("sheet1").Unprotect
Sheets("sheet2").Unprotect
Sheets("sheet3").Unprotect
End Sub

Any advice would be greatly appreciated.
As far as I can see the help from 97 vs 2003 is the sam
 
T

Tom Ogilvy

If you are calling this from a commandbutton, then change the
TakeFocusOnClick property to false

If it is another type of control from the control toolbox toolbar, then as
the first line of code in the event, place

ActiveCell.Activate
 
N

norman1nz

Tom said:
If you are calling this from a commandbutton, then change the
TakeFocusOnClick property to false

If it is another type of control from the control toolbox toolbar, then
as
the first line of code in the event, place

ActiveCell.Activate

Thanks for the tip
Does that only need to be done for Excel 97? Strange. Because it works
fine without activating a cell before protecting in 2000/2003. I will
try this tonight
 
T

Tom Ogilvy

It only has to be done in xl97, but it doesn't cause a problem in other
versions - so you don't need a separate code base for xl97.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top