Bonjour,
Dans son message, < Peter Hewett > écrivait :
In this message, < Peter Hewett > wrote:
|| Hi Peter Hewett
||
|| Credit to Cindy for identifying the gross deficiencies in my code (eats
humble pie).
|| Here's the corrected version:
||
|| Public Sub SpellCheckProtectedForm()
|| With ActiveDocument
||
|| ' Reset, otherwise spell check may not happen
|| .SpellingChecked = False
||
|| ' Document must be unprotected or spell check wont happen
|| .Unprotect
||
|| ' Set proofing so that the TextBox FormFields get spell checked.
|| ' Note: DropDowns don't get spell checked
|| SetFFProofing True
||
|| ' Spell and grammar checks
|| .CheckSpelling
|| If Options.CheckGrammarWithSpelling Then .CheckGrammar
||
|| ' Make form usable again
|| SetFFProofing False
|| .Protect wdAllowOnlyFormFields, True
|| End With
|| End Sub
|| Private Sub SetFFProofing(ByVal boolProofing As Boolean)
|| Dim ffItem As Word.FormField
||
|| ' To make the call to this procedure more logical we negate the value
passed in
|| boolProofing = Not boolProofing
||
|| ' Set or restore proofing state
|| For Each ffItem In ActiveDocument.FormFields
|| ffItem.Range.NoProofing = boolProofing
|| Next
|| End Sub
||
|| Call the "SpellCheckProtectedForm" procedure not "SetFFProofing".
||
|| HTH + Cheers - Peter
||
||
The macro works great... but, from the form designer point of view, there is
one little annoying thing with it. If a form is locked, it means we do not
want users to changed the protected text. The macro, by checking the
normally protected text as well, gives users a chance to play around with
that supposedly untouchable text.... :-(
Just my 2¢
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org