Spell checking protected form

A

Anthony

I have a form (protected but no password) that I use to teach Soldiers
the proper format to wirte a military operations order. I would like
to have the capability to check spelling without having to unlock the
form. I have tried the spell check macro found at the site below and
intalled it accordind to instruction at the site below it.

http://word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm
http://www.gmayor.com/installing_macro.htm

Unfortunately, it did not work for me. I am running MS Word 2007. Is
there something that needs to be changed in the code to account for
the new Word document formats? Or is there something else that I need
to do?
 
G

Graham Mayor

I seem to recall (without taking the time to confirm) that the original
macro only worked with legacy form fields, however the following macro
should check the spelling throughout the document

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

ActiveDocument.Range.Select

'Change language as appropriate
Selection.LanguageID = wdEnglishUK

Selection.Range.CheckSpelling

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


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
A

Anthony

I seem to recall (without taking the time to confirm) that the original
macro only worked with legacy form fields, however the following macro
should check the spelling throughout the document

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

ActiveDocument.Range.Select

'Change language as appropriate
Selection.LanguageID = wdEnglishUK

Selection.Range.CheckSpelling

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

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>




- Show quoted text -

Thanks for the prompt reply. I found a macro already that worked but
I will try yours to see which I like better.
 
A

Anthony

Thanks for the prompt reply. I found a macro already that worked but
I will try yours to see which I like better.- Hide quoted text -

- Show quoted text -

After reviewing the macro fron your previous posting and comparing it
to the one I found at another site, the macros are exactly the same
except for the name. If you wrote it the first time, "Thanks" and
there is someone else who is passing the macro off as his own. BTW,
is there a way to slightly modify this so that it checks each field
upon exit without looping through every field in the form? Thanks,
for your help.
 
G

Graham Mayor

There is no rocket science involved in this macro - I suspect that there may
be several similar versions around - but there are plagiarists out there, so
what was the link? Let's see what else has been duplicated?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
A

Anthony

There is no rocket science involved in this macro - I suspect that there may
be several similar versions around - but there are plagiarists out there, so
what was the link? Let's see what else has been duplicated?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>





- Show quoted text -

Here is the link:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=388
Also, is it possible to modify the macro to check each field
individually as it exits instead of looping through the form upon
exiting the final text form field? Thanks.
 
G

Graham Mayor

Anthony said:
Here is the link:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=388
Also, is it possible to modify the macro to check each field
individually as it exits instead of looping through the form upon
exiting the final text form field? Thanks.

Thanks for the link. As for checking each field on exit, it should be
possible but it would need extensively modifying to determine which field
you were leaving and then you would have to unlock, check the spelling and
relock on exit from each field. This I feel is not really a viable option.
If you wish to persist, I suggest you direct the question to the vba forum
where there are enthusiasts who may have the time and inclination to provide
the extra code ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
A

Anthony

Thanks for the link. As for checking each field on exit, it should be
possible but it would need extensively modifying to determine which field
you were leaving and then you would have to unlock, check the spelling and
relock on exit from each field. This I feel is not really a viable option.
If you wish to persist, I suggest you direct the question to the vba forum
where there are enthusiasts who may have the time and inclination to provide
the extra code ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Thanks for the assistance. What you have written will work just fine.
 

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