Hi, I found this code on the internet, it loops through all form fields and does spell check. Works great. However, when you press the Cancel button, it just moves to the next form field. I'd like to let the user press cancel and exit the subroutine. Can anyone help me with that piece? (I'm more familiar with Excel than Word programming) Thanks!
Sub myTotalCheckSpelling() 'loops through all the form fields 'only checks form fields Dim iCnt As Integer StatusBar = "Spellchecking document ..." With Application.ActiveDocument 'Unprotect if protected If .ProtectionType <> wdNoProtection Then _ .Unprotect Password:="" 'Loop all formfields For iCnt = 1 To .FormFields.Count 'Select formfield .FormFields(iCnt).Select #If VBA6 Then 'Only Word > 2000 Selection.NoProofing = False #End If 'Set Language Selection.LanguageID = wdEnglishUK 'Run spell checker Selection.Range.CheckSpelling Next 'Reprotect without resetting the fields .Protect Type:=wdAllowOnlyFormFields, Noreset:=True, Password:="" MsgBox "Demo all fields spell check completed", vbInformation End With End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks