×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Unable to Spellcheck a protected form

Unable to Spellcheck a protected form

Unable to Spellcheck a protected form

(OP)
I have recently begun creating forms for a law firm and have noticed that when completing a form, the attorneys are unable to spellcheck their comments/answers. The only way I've been able to get around this is to unlock the document. Is there any other way to execute the Spellcheck function?

RE: Unable to Spellcheck a protected form

Unfortunately, the solution is not pretty. This is from a post here last week:

SUMMARY
This article describes methods that allow you to:

Retain information you type into a form field when you protect a form.


Unprotect a forms document, perform a spell check, and retain information in the form fields when you reprotect the form.





MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
Method 1: Alter the Protect/Unprotect Command Functionality
The following Microsoft Visual Basic for Applications macros (Sub procedures) protect your form without causing you to lose the text that you entered into a form field. The macros can be stored in the actual form template to allow you to manually unprotect and reprotect the form while preserving the form field contents.

The following three macros can be used to ensure that your form field values are not reset to their defaults when you reprotect the form.


The first macro runs when you click the Protect Form button on the Forms toolbar.


The second macro runs when you click either Protect Document or Unprotect Document on the Tools menu.


The third macro allows you to specify which sections to protect while maintaining previous form field values.


NOTE: The name of this macro must be ProtectForm.
Sub ProtectForm()

' ******************************************
' ProtectForm Macro.
' Toggles protection for the active document
' when the Protect Form button on the forms
' toolbar is clicked.
' ******************************************
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Else
ActiveDocument.Unprotect Password:=""
End If

End Sub
The following sample Visual Basic macro protects the active document without displaying the Protect dialog box. When you run this macro, it will reprotect the active document while maintaining previous form field values.

NOTE: The name of this macro must be ToolsProtectUnprotectDocument.
Sub ToolsProtectUnprotectDocument()

' ******************************************
' ToolsProtectUnprotectDocument Macro
' Sets protection for the active document
' when Protect Document or Unprotect Document
' is clicked on Tools menu
' ******************************************
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Else
ActiveDocument.Unprotect Password:=""
End If

End Sub
The following sample Visual Basic macro allows you to specify which sections to protect while maintaining previous form field values. You can assign this macro to a toolbar button or menu.
Sub ProtectNoReset()

Dim pDoc As Dialog
Dim x As Integer
On Error GoTo ProtectNoResetErr

' If the document is protected,
If ActiveDocument.ProtectionType <> wdNoProtection Then

' Unprotect the document.
ActiveDocument.Unprotect

End If

' Display the Protect Dialog box.
Set pDoc = Dialogs(wdDialogToolsProtectDocument)
x = pDoc.Display

' If Cancel was chosen, exit this procedure.
If x = 0 Then Exit Sub

' Protect the document.
ActiveDocument.Protect Password:=pDoc.DocumentPassword, _
NoReset:=True, Type:=2

ProtectNoResetErr: 'NOTE: This line MUST be left aligned.
If Err <> 0 Then MsgBox Err.Description

End Sub
Method 2: Create a Macro to Protect/Unprotect Your Document
The following examples protect the active document for forms without resetting the contents of the form fields. Create the macro and assign the macro to a key, menu, or toolbar button for easy access.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If
Method 3: Unprotect, Check Spelling or Update a Field, Reprotect a Document
Because form field text is formatted for No Proofing, you can use the following macro to:


Temporarily Unprotect the form.


Change the language of the form fields.


Perform a spell check or update a field.


Reprotect the form while preserving the text you've typed into the form fields.


You can use this macro as an On Exit macro for the last form field so you can check the spelling or update a field before you save the form.
Sub FormsSpellCheck()

' If document is protected, Unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If

' Set the language for the document.
Selection.WholeStory
Selection.LanguageID = wdEnglishUS

' Perform Spelling/Grammar check.
If Options.CheckGrammarWithSpelling = True Then
ActiveDocument.CheckGrammar
Else
ActiveDocument.CheckSpelling
End If

' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub

RE: Unable to Spellcheck a protected form

(OP)
Thank you so much BarryG! (for answering both my questions!!)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close