Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spell Check Locked and Protected Word 2003 Forms 1

Status
Not open for further replies.

BlueHorizon

Instructor
Joined
Jan 16, 2003
Messages
730
Location
US
Hi all,

I used the following macro in Word 2000 to unlock (the little lock on the Forms toolbar), then unprotect (using a password), then spell check a word document with form fields, then relock (the little lock on the Forms toolbar).

What it doesn't do is re-protect using the original password. How can I make that happen?



Sub FormsSpellCheck()

' If document is protected, Unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="password"
End If

' Set the language for the document.
Selection.WholeStory
Selection.LanguageID = wdEnglishUS
Selection.NoProofing = False

' Perform Spelling/Grammar check.
If Options.CheckGrammarWithSpelling = True Then
ActiveDocument.CheckGrammar
Else
ActiveDocument.CheckSpelling
End If

' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End If

End Sub



Any help is gratefully accepted!! Thanks in advance,
Kathy


Best,
Blue Horizon [2thumbsup]
 
use the same password. Word unlocks with the password. It does not store it unless it IS protected. So if you want the same password, give it that password.
Code:
  If ActiveDocument.ProtectionType = wdNoProtection Then
      ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
         NoReset:=True, Password:="password"
   End If

Gerry
 
Well gosh, I am just covered in blushes.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top