listbox, automatically select specific item

N

natanz

I have a template that i use for making transmittals. In list box "A",
i select the method, egs. fax, courier, us mail, fedex, etc. I also
have a list box "B" for fax number. if "fax" is chosen for listbox
"A" then i want the fax number to appear in listbox "b", otherwise i
want it to stay blank. In the design of my template option 1 for
listbox "b" is blank, and option 2 is the fax number. Do these options
have generic names in VBA, so i can use the same macro for many
different templates. I realize that the ultimate objective would be to
have all this fill in information come from an outside database, rather
than having one template for each person that i send to, but i am not
there yet.
 
D

Doug Robbins

Use the ListIndex property of the ListBox to determine which item is
selected. The following is from the VBA help file:

The ListIndex property contains an index of the selected row in a list.
Values of ListIndex range from -1 to one less than the total number of rows
in a list (that is, ListCount - 1). When no rows are selected, ListIndex
returns -1. When the user selects a row in a ListBox or ComboBox, the system
sets the ListIndex value. The ListIndex value of the first row in a list is
0, the value of the second row is 1, and so on.


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