Re: link text box and dropdown by Doug
Doug
Mon May 19 14:57:06 PDT 2008
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
"Bikertyke" <Bikertyke@discussions.microsoft.com> wrote in message
news:B348A033-E26D-41BE-931B-4D08E4A67817@microsoft.com...
> 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.
>
> "Doug Robbins - Word MVP" wrote:
>
>> 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
>>
>> "Bikertyke" <Bikertyke@discussions.microsoft.com> wrote in message
>> news:CDA2B7E7-C572-45E0-9C82-F2ADDF5F2B7D@microsoft.com...
>> > 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?
>>
>>
>>