Spell check in a locked document

L

LEM

I work in HR. We use a word document for our performance review template.
The template is locked when we send it out to Managers. Because the template
is locked, managers are unable to spell check their text. Is there a way to
lock the template but not the areas where data is entered?

I am able to do this in Excel but have not figured out the trick to make it
work in word.

Thanks!

Laurel
 
L

LEM

thank you for the below. Most of our managers will be using different
versions of word. Can you recommend someone (you?) I can hire to write the
macro below? I contacted someone who does word processing but they weren't
able to do this.

Thanks!

laurel
 
G

Graham Mayor

The macro is already written? You only have to install it

See http://www.gmayor.com/installing_macro.htm which shows how to deploy the
code.

The original web page also shows how to add the extra lines of code should
the form be password protected.

The code is also available from the original page in the form of an addin
for Word versions up to Version 2003 (for Word 2007, it is simpler to use
the macro organiser to copy the macros from the template to the normal
template)
Run the macro on exit from the last form field.


For Word 2002/2003/2007 you could use the simpler code run on exit from the
last form field. Add the password if any between the quotes at both places
it says

Password:=""





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


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

Anthony

The macro is already written? You only have to install it

Seehttp://www.gmayor.com/installing_macro.htmwhich shows how to deploy the
code.

The original web page also shows how to add the extra lines of code should
theformbe password protected.

The code is also available from the original page in theformof an addin
for Word versions up to Version 2003 (for Word 2007, it is simpler to use
the macro organiser to copy the macros from the template to the normal
template)
Run the macro on exit from the lastformfield.

For Word 2002/2003/2007 you could use the simpler code run on exit from the
lastformfield. Add the password if any between the quotes at both places
it says

Password:=""

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

'checkeach 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 sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>




- Show quotedtext-

I found you post and was hoping you could assist me. I have a form
(protected but no password) that I use to teach Soldiers the basic
format for an operatons order. I would like to spell check the form
despite it being locked. I am running MS Word 2007. When I copied
the above code, it did not work. When I went back to the VB editor,
the statement Password:="" is shown in red. I get the following error
message:
Compile error:
Expected: expression

These are the steps I followed to add code. Did I miss something?
1. Open and unprotected form
2. On developer tag, pressed Macro icon
3. Typed in SpellCheckForm and clicked create
4. Deleted the code generated by Word and copied above code into VB
editor box
5. Clicked Save on VB Editor toolbar and closed VB
6. Assigned a button to Quick Access toolbar for the macro
7. For last text form field, clicked run macro on exit
8. Protected form and typed some misspelled text into a form field
9. Ran macro and got error message

Any help is appreciated.
 
G

Graham Mayor

Anthony said:
I would like to spell check the form
despite it being locked. I am running MS Word 2007. When I copied
the above code, it did not work. When I went back to the VB editor,
the statement Password:="" is shown in red. I get the following error
message:
Compile error:
Expected: expression

The macro does work in Word 2007. It appears that the statement you quote
has been orphaned from the line preceding it

The lines should be

ActiveDocument.Unprotect Password:=""

and

ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True, Password:=""

I have split the second line here so that it should not break when copied
See http://www.gmayor.com/installing_macro.htm

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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