Spellcheck only certain form fields in a protected Word doc

R

Roxy

Is it possible to spellcheck only certain form fields in a protected Word doc?
Below is the Macro I have so far but it runs through all the form fields
including the check boxes and I have a 40 page doc which takes almost 5 mins
for the spellchecker to run. I have tried to use the macro in the 'on exit'
properties but that still doesn't seem to work. Any ideas would be greatly
appreciated.
~Thanks, Roxy

Sub SpellCheckForm()
Dim i As Integer
Dim bProtected As Boolean

'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:="colleen"

End If

'check formfield for spelling
For i = 1 To ActiveDocument.FormFields.Count
ActiveDocument.FormFields(i).Select
#If VBA6 Then
Selection.NoProofing = False
#End If
Selection.LanguageID = wdEnglishUS
Selection.Range.CheckSpelling
Next

'Reprotect the document.
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="colleen"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top