View Single Post
  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default add spellcheck in a locked form

If this is a simple form without separate sections in which you simply want
to check the field entries, you can simplify the code to the following -
adding your password between the quotes at the two locations indicated.

The error you are experiencing suggests you have not added the
CheckProtectedSection routine listed on the quoted page.

See http://www.gmayor.com/installing_macro.htm

If you want to spell check a form, then the user of the form must have
access to the macro, which can be saved in the form template the user's
normal.dot template, or the document itself, but if saved in the document
there are macro security implications which could render it unavailable to
many users. You can either run it from a toolbar button or on exit from a
field the user will tab out of.

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

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

End If

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

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


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





CJ wrote:
I am having the same problem with a document using Word 2003. I have
tried following those directions in the link, but I get an error. It
errors on the line that reads..... "Call
CheckProtectedSection(oSection)"

Any suggestions?

Second question, how can you put this into the template for
spellchecking in lieu of having a to build a macro and having it on
the toolbar?

Thank you,

CJ

"Jay Freedman" wrote:

See
http://www.word.mvps.org/FAQs/Macros...ProtectDoc.htm.
Yes, it should be easier than that, but it isn't.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

agates wrote:
I create several of forms in word for our staff. Is there a way
that you can spell check in a field that is in a locked form. The
spell check under tools is not availabe when the form is locked.