link text box and dropdown

B

Bikertyke

Two fold question requireing an idiots guide.
How do i populate a combo box with a list of numbers?
Is it pssible to multiply the selected number from the combo bow with a
number stored in a text box and auto undate a second text box with the result
i.e. textbox2=combobox1 x textbox1?
 
D

Doug Robbins - Word MVP

What type of form are you talking about? A document containing formfields
that is protected or a userform?

What you want to do can certainly be done, but the method is different for
each type of form.

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

Bikertyke

Doug
I've got a document I want to add controls to from the controls toolbox in
the form of text boxes and a combo box. The doc consists of a .bmp chart with
text and combo boxes that sit on top of it to alter the numbers te user see
on the chart. I need, I believe controls as opposed to form fields as the
boxes do not sit in a table but need to be able to be moved (by me and not
the user) to positions that suit the chart / s.
The chart had a fixed set of number (in text boxes) and a set of numbers
that would be changed based on the number selected from the combo box.
 
D

Doug Robbins - Word MVP

Use the following code in the ThisDocument module

Private Sub ComboBox1_DropButtonClick()
Dim i as Long
With ComboBox1
For i = .ListCount to 1 Step -1
.RemoveItem(.ListCount - 1)
Next
For i = 1 to 10
.AddItem i
Next
End With
End Sub

Private Sub TextBox1_Change()
If ComboBox1.ListIndex > -1 Then
TextBox2.Text = Val(TextBox1.Text) * ComboBox1.Value
End If
End Sub

Or, if you don't want a list of sequential numbers in the combobox, use

Private Sub ComboBox1_DropButtonClick()
Dim i as Long
Dim ListArray as Variant
ListArray = Split("1;3;5;7;9",";")
With ComboBox1
For i = .ListCount to 1 Step -1
.RemoveItem(.ListCount - 1)
Next
.List = ListArray
End With
End Sub

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