Populating text boxes with macros in dropdowns

B

Bikertyke

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.
 
D

Doug Robbins - Word MVP

Code such as the following can be used to populate a formfield with an
autotext entry that corresponds to an item selected from a dropdown type
formfield:

' Macro created 15-11-97 by Doug Robbins to add the address corresponding to
a drop down name

'

Set myDrop = ActiveDocument.FormFields("Dropdown1").DropDown

Company = myDrop.ListEntries(myDrop.Value).Name

Address = ActiveDocument.AttachedTemplate.AutoTextEntries(Company).Value

ActiveDocument.FormFields("Text1").Result = Address


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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