PDA

View Full Version : Protected Document, Spell check form field contents



OTWarrior
09-17-2007, 08:44 AM
I have a protected document using form fields, with the user inputting information in the form in said form fields. The user's have requested a spell check facility (as it normally doesn't work in protected mode) and I have obtained the follwoing code:

Sub CheckSpelling()
Application.ScreenUpdating = False
ActiveDocument.Unprotect Password:=""
ActiveDocument.CheckSpelling
ActiveDocument.Protect Password:="", NoReset:=True, Type:=wdAllowOnlyFormFields
Application.ScreenUpdating = True
End Sub

This kinda works, except it doesn't look at the form fields result to check the spelling.

Is there a specific function for this? or would I have to write some code to select every form field maually (a "for, next, loop" kinda thang).

...Or is there no known way to check the spelling in form fields?

fumei
09-17-2007, 08:55 AM
Have you googled this question? It has come up a number of times.

http://answers.google.com/answers/threadview?id=449473

There is full code at the above.

http://word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm

OTWarrior
09-18-2007, 01:26 AM
I did do a search but didn't find any examples, guess my search parameters were wrong :rotlaugh:

I have tried the code you suggested, which works, but it is SLOOOOW!! I mean, it takes 2 minutes to find anything on the first page, and I left it for 5 minutes to check pages 2 and 3 and it was still going.

Is there an example of quicker code? I did look through the example but alot of the code is needed (Or rather I assume it is needed)