|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Is there a way of having text automatically inserted based on the selection of other text?
Hi
I would like to set up a Word document so that, based on the selection of the name of a GP surgery, the surgery's fax number will automatically appear in another part of the document. There are about 30 different surgeries and at the moment we have separate documents for each of them, I would like to combine them into one document. Is there a way of doing this? Many thanks |
#2
|
||||
|
||||
As with your other question, which presumably is related to this one, you are going to need macros to achieve this, so it would probably make sense to create a document template, with a userform containing a combobox to select the surgery and then write the surgery name and the associated fax number to the document.
I would use a multi-column combo box to hold the surgery details and I would maintain the surgery list in an Excel worksheet, which can be quickly read into the combo box. See http://www.gmayor.com/Userform_ComboBox.html for example code to read the data into the combobox For the basics, see Word MVP FAQ - Userforms http://word.mvps.org/FAQs/Userforms.htm for a more in depth explanation, see http://gregmaxey.com/Create_and_employ_a_UserForm.htm When a new document is created the userform can be popped up and the surgery selected. The information relating to that selection is then written to the document as appropriate.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
||||
|
||||
For an alternative approach that is easily maintained and doesn't require a separate data file, see: https://www.msofficeforums.com/word-...html#post46903
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
text based on Combo box selection | rosscortb | Word VBA | 3 | 03-16-2015 06:57 PM |
Hide/Unhide Text Based on Drop Down Selection | gw1500se | Word | 3 | 02-19-2015 12:17 PM |
Show/Hide Text based on Checkbox Selection | tammytran105 | Word VBA | 7 | 10-02-2014 04:30 PM |
Hide/Unhide a Block of Text Based on Choice Selection | inquirer | Word VBA | 7 | 09-22-2014 04:41 PM |
Macro to populate a text form field based on dropdown selection | koloa | Word | 0 | 10-20-2011 11:52 AM |