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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2010 Text Form Spell Checking working! How to set to run always on first field?

Status
Not open for further replies.

remeng

Technical User
Jul 27, 2006
518
US
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:

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
 
Cross-posted at thread707-1783805


---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top