Lock MS Word form except fill-in fields. Create template & force new name for saving.

Hello.  We have a form in 2010 MS Word. It was setup in a word table.  We want to lock the entire document to keep people from changing the document layout.  However, we want certain fields to be open for entering data such as the date, user's name, purpose, etc.  Finally, we want it to be set up as a template and when the user tries to save the completed document he or she will be forced to give the document a new name and location, if possible.  Any assistance that you can give will be appreciated. Thanks.

-sherman6789
sherman6789Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GrahamSkanConnect With a Mentor RetiredCommented:
Sorry, I don't seem to have explained properly.

The original sample was just a demonstration of what a protected document with content controls would look like and would behave,

The macro is designed to convert a document that uses fields in your special way into one that has Content Controls instead. I tested it against the sample document that you posted, but it should work in a similar way with a similar document.

Here is a slightly improved (I think) version that dos not create content controls without pilot text but will use the default "Click to add text" instead.

Sub FieldsToCCs()
    Dim fld As Field
    Dim strText As String
    Dim strFirstWord As String
    Dim rng As Range
    Dim cc As ContentControl
    
    For Each fld In ActiveDocument.Fields
        Select Case fld.Type
            Case wdFieldRef, wdFieldEmpty
                If UCase(Trim(fld.Code.Words.First)) <> "REF" Then 'not intended as a REF field
                    strText = Trim(fld.Code.Text)
                    Set rng = fld.Code
                    rng.Text = ""
                    fld.Delete
                    Set cc = rng.ContentControls.Add(wdContentControlRichText)
                    If strText <> "" Then
                        cc.SetPlaceholderText , , strText
                    End If
                End If
        End Select
    Next fld
End Sub

Open in new window

0
 
GrahamSkanRetiredCommented:
Put content controls in the places where the text is editable, and protect the document for Filling in Forms.

Templates are intended to be used via File/New which creates a new document, so there is no likelihood of overwriting the template.
0
 
KCTSCommented:
Just to clarify after you have created the document and protected it with the 'For filling in forms' option, Save As and select TEMPLATE, then when you select File->New Document you can choose the template (and the document will be saved with a new name)
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
sherman6789Author Commented:
Thank you for your prompt response.  I believe that before protecting the file I need to mark the fields that may be edited by the user.  What is the procedure for marking the areas that will not be locked and can be modified when the form is protected.  Also, can the changeable areas be shaded in grey, yellow or something to aid the user in finding the areas that can be changed?

Thanks.
0
 
GrahamSkanRetiredCommented:
You should mark the areas by inserting a text or a rich text content control in each area. Content controls can be selected and inserted via the Controls group on the Developer Tab.
The Protect document button is also on that tab.

Content controls have some text to show that they are to be filled in - 'Click here to enter text' by default. Also, when the document is protected for Filling in Forms, the text cursor cannot be put in non-editable areas.
0
 
sherman6789Author Commented:
Thanks to both GrahamSkan and KCTS.  This thread will be closed as soon as I am able to use the suggestions given.

Thanks.

-sherman6789
0
 
GrahamSkanRetiredCommented:
Here is a small sample document. One of the two content controls has been shaded.
Content-controls.docx
0
 
sherman6789Author Commented:
Thank you GrahamSkan.  Your sample works the way I want mine to operate.  I have attached a modified version of my form below to let you see what I am working with.  I have placed an "X" in each area that the user would complete.  The rest of the form should be locked so no changes would be made.  Areas such as comments should allow the under unlimited entry by expanding line after line as long as the user types more information.

When I highlight the area and put a statement like "Insert the Director's Name Here" the highlighted area changes to a gray background with these symbols around the statement "{ }" after I click Ctrl-F9.  If I don't type a statement in the area the "{}" is inserted on each entry line.  I then clicked RESTRICT EDITING Box.

It looks ok until I click START ENFORCEMENT PROTECTION.  At that point the input areas disappeared and nothing happens.  I then can not click anywhere on the form until I remove the protection.

Thanks for your help.
OVC-TTAC-Workplan-Template-12-5-.doc
0
 
GrahamSkanRetiredCommented:
You have used Word Fields and have set the document in 'display field codes' rather than 'display field results' mode (Alt+F9 toggles).

Because the first word in the fields is not a field type, they are treated as the default REF fields and would display the contents of a bookmark matching the text name.

It might be possible to write a macro to replace them all with content controls as suggested before. Unless you have already replaced them manually, I'll have a go at such a macro.
0
 
GrahamSkanRetiredCommented:
Word Fields are completely different from Content Controls. They are also not intended to be used in the way that you are attempting.

Content Controls were new in Word 2007. For your purpose, they can be used instead of the earlier Form Fields which were a bit different from other fields. If you need to support Word 2003 or earlier, you will have to use Form Fields, but I'm assuming that you only have to support Word 2007 and later.

This macro will work on the selected document and will convert the spurious fields to Content Controls
Sub FieldsToCCs()
    Dim fld As Field
    Dim strText As String
    Dim strFirstWord As String
    Dim rng As Range
    Dim cc As ContentControl
    
    For Each fld In ActiveDocument.Fields
        Select Case fld.Type
            Case wdFieldRef, wdFieldEmpty
                If UCase(Trim(fld.Code.Words.First)) <> "REF" Then 'not intended as a REF field
                    strText = Trim(fld.Code.Text)
                    Set rng = fld.Code
                    rng.Text = ""
                    fld.Delete
                    Set cc = rng.ContentControls.Add(wdContentControlRichText)
                    cc.SetPlaceholderText , , strText
                End If
        End Select
    Next fld
End Sub

Open in new window

0
 
sherman6789Author Commented:
Thanks again GrahamSkan.  I have several versions of the original file.  Most of them do not have anything in the Fields.  Does that mean that I should follow your original suggestion or should I try to use a micro like the one you wrote above?  Am I correct that in the micro version, I need to give each fillable area a "Field Name" and somehow reference them in the fillin fields?

Did the sample file that you wrote and attached earlier have a micro setup?  It seemed simpler; however, I may not see the work that you did in the background.

What do you suggest?  Remember I am still learning but willing to learn.  A version without anything in the fillin fields are blank in this version.

Thank you.

sherman6789
OVC-TTAC-Workplan-Template-12-5-.doc
0
 
sherman6789Author Commented:
Hello GrahamSkan.  If your original attached sample document did not use macros does it mean that the entire document could be set up the same way?  Normally users type in the information on the form and the data is not used in a database or any other storage.  Management only want a form that is locked where the users can only type in the spaces set aside and can not change the layout of the form.

If I have interpreted the procedures incorrectly, please let me know.  If that is the case, how do I list the field names and how do I implant the micros.  Is the macro embedded within each fillable field or is it placed in one location for the form?

I believe that you are listing the proper steps.  The problem is my inexperience.  If your last message is the best and correct way to make the form, I will spend the time necessary to learn what I need to do.  I realize that you can not spend too much time trying to give me every step.  I will soon close this thread and continue to learn from the information that you and  KCTS have given me.  I appreciate the help.  Thank you.
0
 
GrahamSkanRetiredCommented:
The macro is to convert your document with invalid fields into one with content controls in their place. It is to save you, as the form designer, some tedious work. It is not needed after that. Your converted form can then be distributed as a template without any macros.
0
 
sherman6789Author Commented:
I appreciate the information that you have given me.  Over the weekend I experimented on this project from home.  This is what I did.  I opened the EE sample file that I made.  I put the cursor in a fillable area. In the "developer" I clicked the "Rich Text Content Control" icon for each fillable field.  "Click here to enter Text" popped into each of the fields.  On Page 2, I clicked "Plain Text Content Control" icon for each of those fillable fields.  I then Clicked "Restrict Editing"; 2. Filling in Forms and 3. Yes. Start Enforcement Protection.  At that point I was able to enter the data and it limited making other changes.

1.  I also clicked the date icon for "Click here to enter a Date" in three areas on page 2.

2. What is the difference in clicking "Plain Text" and "Rich Text"?

3.  Can a small "Gray" or "Yellow" background area be temporarily placed in the fillable fields rather than the statement "Click here to enter Text"?  If so, how is it done?

4.  It appears that I could put a pull down box in some of the fillable fields and use it to list all of the "Divisions".  I would then have to learn how to create the list of names for the pull down.

Do I still need to create a macro or did the above create one automatically?

The final thing that I need to do is make this file into a "template".  The managers requested that the file be saved so that users can fillin data but not accidently write over the original files and would be forced to give the new document another "save as" name.

-sherman6789
0
 
sherman6789Author Commented:
Here is the attachment that I intended to upload with the last comment.

Thanks.

sherman6789
EE-Workplan-Template-12-9-13-EE-.doc
0
 
sherman6789Author Commented:
Thanks GrahamSkan for your assistance.  The file works as expected.
-sherman6789
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.