ComboBox with VBA

Joined
Aug 30, 2012
Messages
1
Reaction score
0
Hello,

First of all to mention, I'm really new with VBA and Outlook forms.

I've created an outlook form the easy way without programming (VBA). Just opened a new mail --> go to developer tools and created new comboboxes and so on.

But I noticed that for my intend I have to write some code, because I need a ComboBox_Change.
So I tried to write some code.
First I opened Visual Basic and inserted a UserForm and created two ComboBoxes and wrote this code:

Private Sub ComboBox1_Change()

ComboBox2.Clear

Select Case ComboBox1.Value
Case "Fruits"
ComboBox2.AddItem ("Banana")
ComboBox2.AddItem ("Apple")
Case "Vegetables"
ComboBox2.AddItem ("Tomato")
ComboBox2.AddItem ("Cucumber")
End Select
End Sub
-------------------------------------------------------------------
Private Sub UserForm_Click()

ComboBox1.Clear
ComboBox1.AddItem ("Fruits")
ComboBox1.AddItem ("Vegetables")

End Sub


So far so good. This works. But now I don't know, how I can use this or integrate function to my outlook form I've created first without using VBA.

I hope I could somewhat explain my situation.

Thank you.
 
Back
Top