General discussion
April 28, 2003 at 01:36 PM
brett

Spell check locked fields

by brett . Updated 23 years, 5 months ago

Okay, I have found a macro that will unlock all formsfields in a document, check the spelling and grammar and then lock the form again. This macro worked in one document that was all form fields, but wouldn’t work in another document that was a combination of regular text and form fields. It would only check the text that was already there, not the text that users would enter into the formfields. Here is a scopy of the code:

Sub Spellchecker()

‘ If document is protected, Unprotect it.If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=””
End If

‘ Set the language for the document.
Selection.WholeStory
Selection.LanguageID = wdEnglishAUS

‘ 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, Password:=””
End If

End Sub

Does anyone understand this and does anyone have a solution? Thank you.

This discussion is locked

All Comments