Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-24-2022, 12:24 PM
amcd503 amcd503 is offline Trying to build templated Word doc with user-inputted variables that will be referenced within text Windows 10 Trying to build templated Word doc with user-inputted variables that will be referenced within text Office 2021
Novice
Trying to build templated Word doc with user-inputted variables that will be referenced within text
 
Join Date: Jan 2022
Posts: 2
amcd503 is on a distinguished road
Default Trying to build templated Word doc with user-inputted variables that will be referenced within text

Hi all,

I'm looking for some support on designing a document where a user can enter in a variable and that variable will automatically be entered into the text of the document.

For example, say my document is a templated thank you note. I want to be able to have a user enter in a variable of RECIPIENT and CITY and DATE in order for the document to automatically place the inputted variable into defined spots in the document:



e.g.:

Dear [RECIPIENT],

Thank you for attending the Very Fancy Auction held in [CITY] on [DATE]. Blah blah blah. We hope you were able to enjoy your stay at the Hilton [CITY] and explore everything that [CITY] has to offer. It is contributors like you, [RECIPIENT], that allow our organization to prosper. Blah blah blah.

Is there a way to do this in Word?
Reply With Quote
  #2  
Old 01-24-2022, 02:04 PM
kilroyscarnival kilroyscarnival is offline Trying to build templated Word doc with user-inputted variables that will be referenced within text Windows 10 Trying to build templated Word doc with user-inputted variables that will be referenced within text Office 2019
Expert
 
Join Date: May 2019
Posts: 345
kilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nice
Default

There are at least a couple of ways of doing this.

Bookmarks and cross references can work pretty well. You set up your variable by highlighting the generic term like City in the image below, and Insert Bookmark. Give that bookmark a title (e.g., "Location") so you can reference to it later. This little document explains them pretty well. http://www.docs.is.ed.ac.uk/skills/d.../3617/3617.pdf

Keep in mind that you'll have to teach people to either be careful about the brackets around the key words, or better yet, how to fix it themselves if they mess it up. One of my coworkers seems to invariably delete one of the brackets, thus getting "Error! Reference Source Not Found" and I have to fix it for her. You'll want to make sure all users in your group go into Options in Word and check "Show Bookmarks" in the "show document content" under the Advanced tab in Options, or they won't probably see the brackets like in the image below. The other thing is, the cross-references and field codes won't automatically update on their own, but the easiest way to update all is to do a quick Print Preview.

You can employ a VBA user form that would pop up when the document opens, and prompts the user to fill in the blanks. This may be helpful if you have a variety of users at different experience levels, or users who really hate having their formatting symbols show by default, as with bookmarks I found users tended to mess up by not typing within the required brackets, or backspacing over them. But for that you'll have to know enough VBA to make it work. This guy's simple instruction might work for you. Using a Form in MS Word to Populate a Document - YouTube I did try this setup for one type of short document we use, but I'm the only one employing it for now.

Finally, you might want to think about using a mail merge setup. That's where people would plug the key data into a table in Excel, and then use that table to populate fields in a linked Word document. We think of using mail merge to send form letters or Emails, but it might be a great solution for this. If you're not up to speed on mail merge, this video is a good overview and I find her very easy to follow. Properly Use Mail Merge from Excel to Word & Outlook | Dynamic Linking between Excel & Word - YouTube

Something to keep in mind: RECIPIENT might sometimes be Mr. Jamal Hargrove, elsewhere just Jamal or Mr. Hargrove, so that may require collecting title (Mr., Ms. etc.), first name, last name, and additional optional segments such as III or Ph.D. in separate fields, depending upon how formal or informal your document is meant to be.

Edited to add: I re-read your example use of a thank-you "form letter" and really think mail merge is the way to go for this for now. Also I failed to mention, this forum has a whole separate excellent section on Mail Merge under the main Word portion that is worth checking out.
Attached Images
File Type: jpg bookmark and xref-1.jpg (7.4 KB, 12 views)

Last edited by kilroyscarnival; 01-24-2022 at 02:45 PM. Reason: Added note for clarity
Reply With Quote
  #3  
Old 01-25-2022, 09:26 AM
amcd503 amcd503 is offline Trying to build templated Word doc with user-inputted variables that will be referenced within text Windows 10 Trying to build templated Word doc with user-inputted variables that will be referenced within text Office 2021
Novice
Trying to build templated Word doc with user-inputted variables that will be referenced within text
 
Join Date: Jan 2022
Posts: 2
amcd503 is on a distinguished road
Default

Wow, thank you so much for the quick reply and the thorough explanation of different possible options! I think I'll take your advice and try the Mail Merge approach first and report back on how it went. Cheers.
Reply With Quote
  #4  
Old 01-25-2022, 11:10 AM
kilroyscarnival kilroyscarnival is offline Trying to build templated Word doc with user-inputted variables that will be referenced within text Windows 10 Trying to build templated Word doc with user-inputted variables that will be referenced within text Office 2019
Expert
 
Join Date: May 2019
Posts: 345
kilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nicekilroyscarnival is just really nice
Default

Quote:
Originally Posted by amcd503 View Post
Wow, thank you so much for the quick reply and the thorough explanation of different possible options! I think I'll take your advice and try the Mail Merge approach first and report back on how it went. Cheers.
Thanks! I've been exploring various ways to do that sort of thing. Most of my usage is for creating proposals and reports, not generating multiple letters or Emails, though I've done some of that too.

I don't know how new you are to mail merge. There are some good task tutorials on most subjects on YouTube, but also if you are on LinkedIn and haven't already used a free trial to LinkedIn Learning (formerly Lynda.com), the Word courses taught by Gini Von Courter there are quite good. It's a full one month free trial (or at least it was recently) and I paid for a subsequent month, taking a bunch of courses when I changed jobs several years back.

Best of luck,

Ann
Reply With Quote
  #5  
Old 01-25-2022, 11:24 AM
Charles Kenyon Charles Kenyon is offline Trying to build templated Word doc with user-inputted variables that will be referenced within text Windows 10 Trying to build templated Word doc with user-inputted variables that will be referenced within text Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,138
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

See Repeating Data Using Document Property Content Controls and Other Mapped Content Controls for the easiest way.


Mail merge works well if you need to use the same information many times in different documents (or, obviously, do bulk mailings).
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate document from templates and user variables - Field, Property, BBlock or Mapped Control Form TheBigBoss Word VBA 4 09-07-2021 06:30 AM
Auto-populate based on text inputted into a field by user + formulas ssims Word 1 11-30-2020 12:17 PM
user variables eNGiNe Word 3 09-03-2020 11:32 PM
Automatically update user-inputted date after specified time range PrincessApril Excel 22 12-04-2019 10:15 AM
Mail merge with filter using data inputted by user Tornado70 Mail Merge 6 04-09-2013 07:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft