Automatic population of text boxes from dropdown selections

G

Guest

I'm trying to produce a document in WORD 03 that will allow a user to select
items from dropdowns in a list of contents that will then populate text boxes
in other areas of the document with information relevant to the selection
made in the dropdown e.g. if the user selects apples from the drop down the
description will automatically be populated with, say "fresh and crunchy,
ideal for snacks' and the colour will populate with 'red'. If the user
selects pears different descriptions and colour would be used.
It would also be preferable for the dropdown and text box to be removed if
no selection is made in order that no gaps are left in the body of the
document.
Ideas for macro's gratefully recieved as programing is not a strong point.
 
G

Guest

Greg

Thanks for that.

I presume i'd substitute 'Dim oDD As DropDown' with 'Dim oTF As TextField'
(TF) and "SecondaryDD" with "PrimaryTF" or similar.
Since I do not want to ListEntries what would be the substitute for
'oDD.ListEntries' entry?

Thanks again.
 
G

Greg Maxey

Use something like this:

Sub OnExitDDListA()
Dim oFFs As FormFields
Set oFFs = ActiveDocument.FormFields
Select Case ActiveDocument.FormFields("DropDown1").Result
Case "A"
oFFs("Text1").Result = "First letter of alphabet"
Case "B"
Case "C"
End Select
End Sub
 
G

Guest

Can I add anything to auto update the text box as soon as the dropdown is
clicked. The text in the box is not updated for prints and saves without
clicking outside the dropdown and this could lead to errors.

Cheers
 
G

Greg Maxey

I am not 100% sure, but I think the short answer is no. That and other
annoyances are why I usually avoid protected forms and use a UserForm
instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top