Spellcheck protected worksheet problem

  • Thread starter Thread starter CharleneG
  • Start date Start date
C

CharleneG

I'm having problems with using the macro recommended by other messages.
The macro seems to run okay, the spell check works using a button, an
the worksheet acts like it is then protected. But when I go to tool
and unprotect document it will unprotect the document without askin
for the password. I did use the ActiveSheet.Protect password:="123"
 
This is the formula I used. It seems to work fine. The worksheet i
protected. I created a button, the button works and spellcheck work
fine. The protection part seems to be fine. But if I click o
unprotect document it doesn't ask for the password.

Sub spellcheck()
ActiveSheet.Unprotect password:="123"
Cells.CheckSpelling CustomDictionary:="CUSTOM.DIC"
IgnoreUppercase:=False_, AlwaysSuggest:=True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True
ActiveSheet.Protect password:="123"
End Su
 
Hi
the problem is that you call two times the protection method (and only
the first one is invoked). Combine the lines as follows and it should
work:

Sub spellcheck()
ActiveSheet.Unprotect password:="123"
Cells.CheckSpelling CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False_, AlwaysSuggest:=True

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, password:="123"
End Sub
 
Back
Top