Microsoft Word - Drop down list how to use value in other parts of document

Hi,
I have a microsoft word document. I inserted a drop-down list in the document.
How do your use the value of what was selected in the drop-down list?

Example:
Please enter city [DROP-DOWN LIST of CITIES]

Further down in the same document I want to use what was selected in the drop-down list
and display the city that was selected.

How would I do this?

Thank you!
Darin
waipahuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
You could bookmark the list and put a REF field using the bookmark name at the place where the text is also to be displayed.

REF fields, like most fields are not automatically updated. The simplest way to update a field is to include it in the selection and press F9.

Presumably you are using a Content Control. Alternatively, you could use a 'Legacy' Drop Down Form Field and set 'Calculate on Exit' to force field updating. However, you would have to use Forms protection.

Not everyone is comfortable with VBA, but it would be possible to automate field updating with VBA macro code.
0
waipahuAuthor Commented:
Thanks
I tried using legacy drop-down list and just a grey box with the top value of the list is displayed.
There is no drop-down.  Am i doing something wrong?
0
GrahamSkanRetiredCommented:
While the document is not protected, you can right-click on the field and add items and also note, or change, the bookmark name. When the document is protected for forms a dropdown arrow appears on the right of the field. You can select any item that is in the list.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

GrahamSkanRetiredCommented:
If you don't want to use document protection, try using a Content Control drop down instead of a legacy form field drop down.

You have asked the same question here:

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Q_28267690.html

This is confusing and against Experts-Exchange policy. You can delete it yourself while there are no comments. Please do that so that we don't have to request attention from a moderator.
0
GrahamSkanRetiredCommented:
Attached is a sample document.

To automate the field updating, put this code in the ThisDocument module
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
    ActiveDocument.Fields.Update
End Sub

Open in new window

EchoContentControl.docx
0
waipahuAuthor Commented:
Sorry, I deleted the other question.  I added content control drop down list.  

Select Name:  [drop-down list]

Use drop down list value here [value of drop-down list value here].

How would you do this?  

thank you!
0
GrahamSkanRetiredCommented:
Add the drop down list control
Select the control and add a bookmark (Insert Tab)
Switch to design mode (Developer tab)
Select Properties and use the Add button to fill the drop down list.
Switch out of design mode.

Select the echo position, and click Quick Parts (Insert tab) . Choose Field..., select Ref in the left-hand box of the Field dialogue, and find and select your bookmark in the Field properties list.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
waipahuAuthor Commented:
Is this where i put that code in..see screen print.   Still not working.  Probably not doing it right.thisDocument code
0
waipahuAuthor Commented:
Let me try again. reading your other post
0
waipahuAuthor Commented:
Here is the test document I created.   Maybe you can see what I'm doing wrong.
TestForm.docx
0
GrahamSkanRetiredCommented:
You have bookmarked the start of the content control. You need to select all of it for the contents (actually the whole control) to be redisplayed in the REF field.

It might help to show the bookmark locations. It is an setting under Show document content in Advanced options.

You might also like see the field codes sometimes. The Alt+F9 keystroke will toggle between displaying field codes and results in the document.
0
waipahuAuthor Commented:
Thanks for your help. I booked marked the entire content control but the REF field is not being updated with the value selected in the drop down list.
Do i need to create a macro linked to a button using  document variables?
0
waipahuAuthor Commented:
The lastest test document.  Seems like it copies the entire content control drop down list, instead of the value of what was selected. I just want the value of what was selected.
TestForm.docx
0
GrahamSkanRetiredCommented:
Yes, that is what my aside "(actually the whole control)" was referring to. However content controls look like ordinary text unless selected, and aren't visible at all when printed.

There isn't a completely simple way of doing what you need. If it really is a problem for you, it would be possible to bookmark the target location instead and to use VBA to fill it.
Something like this:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
    Dim rng As Range
    If ContentControl.Title = "Name" Then 'ccName would be better to avoid confusion the .Name property of some objects
        Set rng = ActiveDocument.Bookmarks("bmkName").Range
        rng.Text = ContentControl.Range.Text
        ActiveDocument.Bookmarks.Add "bmkName", rng 're-add bookmark
    End If
End Sub

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.