Group: microsoft.public.word.vba.general
From: =?Utf-8?B?Um94eQ==?=
Date: Tuesday, April 08, 2008 10:53 AM
Subject: RE: Can't Spellcheck individual form fields in a protected form

Thank you for your quick responses.
When I copy and paste the exacty as it is from the website it get an error
message "Password Incorrect", because I have my forms protected with a
password that only I the creator will know and none of the users will know.
I thought you need to program into the code with the password to unprotect,
run spellcheck, reprotect so the user doesn't get asked what the password is.
Am I incorrect?

"Jean-Guy Marcil" wrote:

> "Roxy" wrote:
>
> > Yes, when I tried the code from the MVP page I ran into trouble when I needed
> > to unprotect and then reprotect my document. Can you tell me exactly where
> > to insert into the code:
> > oDoc.Unprotect Password:="Password"
> >
> > And:
> >
> > oDoc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, _
> > Password:="Password"
> >
> > This part I couldn't figure out and I was having a hard time.
> > Once I get this part to work, do I just leave the code in the doc itself or
> > do I need to put it as a 'run on exit' function in order to spellcheck one
> > form field at a time? Thanks so much again for all your help, I have been
> > just learning by trial and error so if I misspeak or don't make any sence
> > please forgive me.
>
> On the page
> http://word.mvps.org/faqs/macrosvba/SpellcheckProtectDoc.htm
> point number 2 is where you got the code you posted above.
>
> The web page assumes that you will be using the code it provides, threfore
> you are supposd to replace the lines in the code in point one by the ones in
> point 2. Now, I believe that you are using your own code...
>
> You posted the following code in your original message:
>
>
> 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"
>
>
> You are already unprotecting/re-protecting with a password... I do not
> understand why you are trying to do it again.
>
> As to your second question "Once I get this part to work, do I just leave
> the code in the doc itself or (...)", the answer is on the same web page, see
> point #3.
> Users have to initate the spell checking with a menu/toolbar button or a
> keyboard shortcut, which is the standard with all documents... Point #3 has a
> link that takes you to a page that tells how to do this. That second page
> also has a link that takes you to another page that tells you how to link a
> macro to a hotkey...