So after an extensive amount of research over several months, I cam across the code to finally check the text form fields in a Word Form. The only issue with it is that it won't always start at the top of the document in the text field. The code will eventually get to the field which is good.
1) is there a way to automatically start at the first field instead of somewhere else?
2) When you press the cancel button when the spell check is working, it won't cancel / end the spell checker until it has gone through the complete document. Is there a way to resolve this?
3) On occasion, the spell checker will check the same field multiple times if the ignore once button is pressed. Is there a way to prevent this?
Other than those 3 points, the code works great!
Here is the original page with the instructions as reference: [URL unfurl="true"]http://www.vbaexpress.com/kb/getarticle.php?kb_id=388[/url]
Code:
1) is there a way to automatically start at the first field instead of somewhere else?
2) When you press the cancel button when the spell check is working, it won't cancel / end the spell checker until it has gone through the complete document. Is there a way to resolve this?
3) On occasion, the spell checker will check the same field multiple times if the ignore once button is pressed. Is there a way to prevent this?
Other than those 3 points, the code works great!
Here is the original page with the instructions as reference: [URL unfurl="true"]http://www.vbaexpress.com/kb/getarticle.php?kb_id=388[/url]
Code:
Code:
Sub spellcheck2()
If MsgBox("Would you like to spell check?", vbYesNo, "Spell Check") = vbYes Then
MsgBox ("The screen may flash while Spell Check is Running")
Dim iCnt As Integer
ActiveDocument.Unprotect Password:="test"
For iCnt = 1 To ActiveDocument.FormFields.Count
'Select formfield
ActiveDocument.FormFields(iCnt).Select
#If VBA6 Then
'Only Word > 2000
Selection.NoProofing = False
#End If
'Set Language
Selection.LanguageID = wdEnglishUS
'Run spell checker
Selection.Range.CheckSpelling
Next
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, Noreset:=True, Password:="test"
MsgBox ("Spell Check is complete")
Else
End If
End Sub