Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Back to Microsoft Word Forum    Comments List
Microsoft Word Form Upload Images   Link   Email  
Janelle Davis      
16 months ago
Where would I find the lessons do to the following?  I have a couple letters I send out once a year.  There are only a few things that need changed on each one before they are sent out.  I would like to turn these into forms where anyone opening it would only have the option to change these specific items and would be required to change these items.  We are potentially doing some restructuring and I want to prevent the person taking over from being able to accidentally delete words, etc.
Janelle Davis      
16 months ago

Janelle Davis      
16 months ago
I guess I could also specify, I've stumbled through creating some Word documents with form fields before, but it has been a while.  Also, on this specific example, I would not be opposed to the first three yellow highlights automatically populating, but I wouldn't want them to change after they've saved it.  This file is currently saved with my information on what we refer to as our department's H drive in a folder for my specific tasks and is titled "RWD Letter".  Each year when I send it out, I save it in a subfolder with the year added to the end of that title.  "RWD Letter 2023"  The boss wants to be able to quickly reprint the letter or see the date it was mailed and/or requested back.
Kevin Yip        
16 months ago
The key thing is: do you want to automate all these tasks, or will you be doing them manually?  Creating a form letter with variable fields can be done with mail merge, which can be done manually (by going through wizards and dialogs), or be automated with VBA.  I believe this site has videos on both, although the videos may be old.  To protect your document, the manual way is go to Review -> Restrict Editing (on ribbon) -> Editing Restrictions, choose "read only" -> click "Enforce Protection" and choose a password (otherwise all users can unprotect it).  VBA can automate that too.
Janelle Davis      
16 months ago
Which way would you recommend would be best to use when I know the person that will be taking over these tasks is not computer literate (as in has asked me multiple times this week already how to insert a row in Excel)?  I have worked with Mail Merge a few times but have not started learning VBA yet.  I enjoy learning all of this stuff though and am currently going through the Access classes.
Kevin Yip        
16 months ago
I'd suggest doing it the simple way first; when your needs increase, then consider more complicated solutions.  A simple way would be a letter with empty boxes for your user to fill in.  To protect the document, only the empty boxes will be editable.

Those fillable boxes are part of "form controls."  To add them, first you need to turn on the Developer menu.  Go to Word -> File -> Options -> Customize Ribbon, scroll down the list on the right, and check the box "Developer" (it is unchecked by default).  Click OK.  There should a "Developer" menu on top now.

Open a blank document and type your letter.  To put form controls on the page, click "Developer", click "Designer Mode".  On the ribbon, click on any control you want: plain text box, date picker, etc.  The control will be immediately put on the page.

To automatically insert today's date that you don't want your user to change later, add a "plain text box" as described above.  Then put the cursor inside it.  Click "Insert" on top.  On the "Text" section of the ribbon, click Quick Parts -> Fields -> Date, and set the date format.  This field always shows the system date.  So your users will always see the current date whenever they open the document.

To make this date uneditable, go into the properties of this control (click "Properties on ribbon) and check "Content cannot be edited".

You can add more boxes for users to fill in -- name, address, etc. -- in the same manner as above.

Be sure to click "Designer Mode" again to exit design mode after you finish setting up form controls.

To make only the fillable boxes editable, go to Review -> Restrict Editing -> check the box "Allow only this type of editing", and select  "Filling in forms".  Click "Yes, start enforcing protection".

Important final step: save the above as a template.  Go to File -> Save as, and save it as a Word Template (*.dotx). Make sure you open up "More options..." and check the box "Save thumbnail."

If you're not familiar with templates, they are for creating new documents with pre-existing content and settings.  You want your users to create a new letter without having to open an existing letter to make changes and saving it as new.  So, making your letter a template would be useful here.

Setting up a template is slightly tricky.  First you go to File -> Options -> Save, and put in a location in "Default personal templates location". Click OK back out, and restart Word.

Open Word, go to File -> New, and next to "Blank Document", you should see your template with its thumbnail (see picture below).  When your users open this, they will not open the template itself; they will open a new doc with a generic file name (Document1.docx) with the template's content in it.  The new doc will be protected just like the template, with only the fillable boxes editable.

I say this is the "manual" way because there is no way to check for data entry errors.  Someone still has to "manually" look at what the users typed and check for errors.  To make this more error-proof would require adding some validation methods, which would likely involve coding, database, and more.

Kevin Yip        
16 months ago

Janelle Davis      
16 months ago
Thank you so much for these instructions!  They are clear and easy to follow!

Is there a way to have the previous year entered automatically?  So if I opened a new document off of the template today, my date at the top is filling in as "February 24th, 2023" and I have a sentence that says "...on file from 2022."  I know I can do the exact same with the date and give it the formatting of YYYY to only display the year, but how would I make it be last year?
Kevin Yip        
16 months ago
To insert the previous year, you need to create a calculated field.  That's a bit trickier, because it cannot be done with the ribbon or menu (not that I know of).

First, you type this at the location where you want to put your year:    Date \@ yyyy

Select it (drag your mouse over it), press Ctrl-F9.  It is turned into a formula field, with brackets { } around it.  This formula takes only the year from the system date, so it should yield 2023.

Click somewhere else on the page to get your cursor back.  Then add an equal sign just before the formula field.  Add "-1" (no quotes) just after the formula field.  The result should look like Figure 1 below.  Note that "=" and "-1" should be outside of the shaded area that contains the formula.

Then you select the whole thing, so that the entire line is shaded:   ={Date \@ yyyy}-1

Press Ctrl-F9 again, and the whole thing is turned into another formula, with { }, and shaded.

Press F9.  This is the shortcut key for performing the calculation.  And, bam, you see 2022.  What the formula does is subtract one from the current year.

To view the formula again, put the cursor on 2022, press Shift-F9.  You may see something like ={2023-1}.  Put the cursor on 2023, press Shift-F9, and you see the first formula again.  Select the whole thing, press F9, to get back 2022.  
Kevin Yip        
16 months ago

Kevin Yip        
16 months ago
Hi Janelle, earlier you said you wanted the dates on the letter to NOT change after your users finish creating the letter.  That may require some VBA.  If the following scenario describes what you want:

1. Your user creates a letter from the template.  The template sets the date automatically to the current date, e.g. February 24, 2023.  The user saves this letter as Document1.docx.
2. A week later, your user creates another letter from the template, with the date set to March 3, 2023.  The new letter is saved to Document2.docx.
3. Some time in the future (weeks, years, etc.), when anyone opens Document1 and Document2, you want the dates on those letters to remain February 24, 2023 and March 3, 2023.

Then we need to use VBA.  I cannot think of a way without using it.  The actual coding may look simple -- it's only a couple of lines of code.  But once you are in VBA, it is a sudden jump in complexity, because every line of code involves quite a bit of knowledge.  I will write another post shortly to give you a brief rundown.
Kevin Yip        
16 months ago
To be able to use VBA, your template needs to be saved in the "Word Macro-Enabled Template (*.dotm)" format.

Turn off protection in your template, because VBA code can't run if the file is protected.  You'll have VBA turn protection back on later.  Go to Developer -> Restricted Editing, and uncheck all the boxes.

Go to Developer, and click "Visual Basic" on the ribbon.  The VBA editor window opens up.  Under the section for your template file, double-click "ThisDocument" to open up the coding screen on the right.  

Type the code as shown in the picture below.  I'll briefly describe what each line does.

The first line "Sub AutoNew()" means this code is run whenever the user creates a new document based on this template.

"Selection.Wholestory" is the equivalent of selecting the entire document by pressing Ctrl-A.

"Selection.Fields.Unlink" turns all selected fields into "hard text," so they aren't fields anymore and won't update to the system date.  This is how you prevent dates from changing.  This is equivalent to selecting a date field and pressing Ctrl-Shift-F9.  But you can't count on your users to always press Ctrl-Shift-F9, so this is why we need this VBA code to do it automatically.

The last line of code password-protects the document.  Note that you need to put your own password here.  Since this template file is unprotected (in order for VBA to run), anyone who sees this screen will see the password.  So you need to prevent your uses from accessing the "Developer" menu.  In a network environment, you may need to put the template file in a read-only folder as well.

The result is this: when a user creates a new document based on this template, he will see dates that are pulled from the current system date, yet the dates will be "hard text" and unchangeable.  The document will also be password-protected as well, with only the fillable boxes editable.  I think this accomplishes all your goals.

Of course, I would like you to be well-versed in VBA first before using this method.  You may try the code above for testing purposes.  This site has plenty of Access VBA material, but I don't know if it has Word VBA material or whether it is up to date.
Kevin Yip        
16 months ago

Richard Rost             
14 months ago
Janelle, I know you're also an Access student, have you thought about just doing this in Access? Would be so much easier. Letter Writer

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Microsoft Word Forum.


The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
My Account
My Courses
Lost Password
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Customer Support
Web Site Tour
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/25/2024 8:47:53 AM. PLT: 0s