Word - Drop-down Lists and Auto-Population

Asked By George Gueorguiev
12-Mar-10 11:10 AM
Hello,

I am working on a Word (2007/2010) document and trying to create a table full
of drop-down lists. I want to be able to select a value from each drop down,
and have this selection show up later in the document. I have been plugging
through VB trying to write this up, but I cannot seem to set up a label or
field that I can write a value to. For example, it would look something like
this:
We've got a drop-down list at the top of the document, 3rd page and a
label/text field on, say, page 6. User selects "Option 2" in the drop-down
list. Instantly, the label/text field reads "Option 2".

How can I accomplish this?

Thank you very much for your time & assistance.
Microsoft Word
(1)
ActiveDocument.FormFields
(1)
Word 2007
(1)
VB
(1)
TblsFldsFms
(1)
ExitDD
(1)
FAQs
(1)
Bookmark
(1)
  Jay Freedman replied to George Gueorguiev
12-Mar-10 02:29 PM
I will assume you are dealing with legacy form fields and not content
controls...

Each dropdown needs an exit macro that transfers the .Result of the dropdown
to the .Result of the corresponding text field. As an extremely simplified
example, if there was only one dropdown and one text field, you could use
this:

Sub ExitDD()
With ActiveDocument.FormFields
.Item("Text1").Result = .Item("Dropdown1").Result
End With
End Sub

Of course, the names in quotes would need to match the bookmark names of the
fields.

If the bookmark name of each dropdown field corresponds to the name of its
text field -- for example, with the same number attached to the end of the
name -- then you could make just one exit macro and assign it to all of the
dropdowns. That macro would have to figure out the name of the dropdown that
was just exited
(http://www.word.mvps.org/FAQs/TblsFldsFms/GetCurFmFldName.htm) and compute
the name of the corresponding text field.

By the way, if you are using content controls, they do not have exit macros,
but there is a completely different mechanism for linking them. See
http://gregmaxey.mvps.org/Mapped_Content_Control.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
  George Gueorguiev replied to Jay Freedman
12-Mar-10 04:36 PM
Thanks for your help Jay, this is exactly the information I was looking for.

I am using content controls by the way, and got my project working. Many
thanks!
help
Visual Basic opening when word macro is initiated Word I have written several VBA macros that are initiated when the cursor leaves a field inserted into a Word form. When this happends Visual Basic automatically opens. How can I keep Visual Basic from opening when this happends. Word VBA Discussions ActiveWindow.View.ReadingLayout (1) Windows XP (1) Office XP (1) Microsoft Word (1) ActiveDocument.FormFields (1) Office 2007 (1) Office (1) Word (1) The VBA editor is probably opening because
Search for an Unchecked Checkbox Word Microsoft Word 2003 I need to create a macro that searches the document for checkboxes that are down form. What is the code for searching for an unchecked checkbox? thanks, - - Debra Ann Word VBA Discussions Office XP (1) Microsoft Word (1) ActiveDocument.FormFields (1) Vista (1) WdFieldFormCheckBox (1) VB (1) WordVBA (1) VbOKCancel (1) Hi Debra, Sub Makro2
Macro won't work, please help! Word I have CheckBox "Check1" and a FormField "Duration". My macro is supposr to put "48 a check, and when the checkbox is empty "Duration" will also be empty. Windows XP, Word 2007 Can someone help me with this macro. The error message says "Block if without is suppose to run the macros on enter. Here is my macro Sub IsChecked() If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then ActiveDocument.FormFields("Duration").Result = "48.6" Else If ActiveDocument.FormFields("Check1").CheckBox.Value = False Then ActiveDocument.FormFields("Duration").Result = "" End If End Sub Word VBA
Remove Text Word I'm using the following code to remove some text form fields plus a logo i have at the top of my template. ub RemoveHeader() ActiveDocument.FormFields("Text12").Delete ActiveDocument.FormFields("Text13").Delete ActiveDocument.FormFields("Text14").Delete ActiveDocument.FormFields("Text15").Delete ActiveDocument.FormFields("Text16").Delete ActiveDocument.FormFields("Text17").Delete ActiveDocument.FormFields("Text18").Delete
Combining Checkboxes in Word Forms Word Hi All, I have a Word template on which there is a group of 3 checkboxes. I would like to prevent I thought this code might work, but it does only part of the time. . . If ActiveDocument.FormFields("SectionE1").CheckBox.Value = True Then ActiveDocument.FormFields("SectionE2").CheckBox.Value = False ActiveDocument.FormFields("SectionE3").CheckBox.Value = False ElseIf ActiveDocument.FormFields("SectionE2").CheckBox.Value = True Then ActiveDocument.FormFields