Need help with Spellchecker code in a protected form

S

Sandy

I have copied and pasted the code from the Word MVP site
regarding using spell check for a protected form. I'm
really new at vba and only added the password information
as stated at the end of the article. My problem is this,
it doesn't work and I'm not clear on why.

I unprotected the form
Clicked on Tools, Macro, Record New Macro, gave it a name,
stopped recording.
Back to Tools, Marcro, Macros, Stepped into SpellCheck
Macro, Pasted code copied from article.
Modified the oDoc.Unprotect line to read: oDoc.Uprotect
Password:="XXXX"
Modified the oDoc.Protect Type:=wdAllowOnlyFormFields,
NoRest:=True to read:eek:Doc.Protect
Type:=wdAllowOnlyFormFields, NoReset:=True, _
Password:="XXX"

I saved and closed the VB window. Protected the form and
saved. Clicked on Tools and Spellcheck is greyed out.
Clicked on Tools, Macro, SpellChecker, Run and nothing
happens.

MSWord 2002

Any help is greatly appreciated.

Thanks,

sandy
 
C

Charles Kenyon

I assume you are talking about the macro from
http://www.mvps.org/word/FAQs/MacrosVBA/SpellcheckProtectDoc.htm.

That macro checks the following:
Anything in a text field.
Anything in an unprotected section.
It does not check the protected text in the protected section.

To test it you need misspelled words in one of those two locations.

Tools => Spellcheck will be grayed out unless you replace it with a command
for your macro. I attach the macro to my F7 key to make it easier to run. It
will spell-check unprotected documents just fine.

The macro does have a problem in Word 2003 if there is an unprotected
section followed by a protected section. Otherwise it works fine and it
looks to me like you installed it correctly.

Hope this helps,
 
S

Sandy

Thank you so much. Yes, I have proctected sections
followed by unprotected sections.

sandy
 
C

Charles Kenyon

Are you using Word 2003? If so, the problem is that the macro will check
text in protected sections that follow unprotected sections. I believe this
is a new bug in Word 2003. You can work around it by (with the document
unprotected) selecting the text in the sections that will be protected and
marking them with the language setting "do not check spelling or grammar."
 

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