Discussion Locked

Forms

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have created a Form in Excel VBA. However the default form only has a close button. I need to have the following functionality on the form as well:
(a) minimize and resize/restore
(b) Scroll bars

How do I add the above.

Also on the form I need to have a drop down list box with optional choices. I need to click on one of the option and have it place the selected option in a separate text box.

3 replies

by sergey kovzik

a) Impossible - Forms are Dialog boxes, so you can't change it style. Hide/Show might help you
b) Click at empty space on form. Then click F4 - you should get to Forms Properties. Here should be ScrollBars field - by default it equal to fmScrollBarsNone. Change to whatever you needs

dropdown with text boxes. Add ComboBox and Text Box objects. Then add following code.

you can provide fixed list of values like below or you can choose them from some lsit object

Private Sub UserForm_Initialize()
ComboBox1.AddItem "1st"
ComboBox1.AddItem "2nd"
ComboBox1.AddItem "3rd"
ComboBox1.AddItem "4th"
End Sub

and this one is event handler for listbox change

Private Sub ComboBox1_Change()
TextBox1.Value = ComboBox1.Value
End Sub

Sincerely, Sergey
Brainbench MVP for Win98 Administration

This discussion is closed to new replies.