BTW: you have duplicate question at:
http://www.experts-exchang
I think you can delete it before any comment posted in it.
Suat
Main Topics
Browse All TopicsHi,
I am going to create a list box with option buttons or check box using VBE in my program, but I don't have any idea about it. Can any experts help me? In the list box, I will give a number of option that the user have to choose and check the box(only one box can be checked). After that the user will click OK and the function that he had choose will perform the task. So, in the program, it will call the function that have been chosen by the user. So, how to write the code that will pass the parameter? hope somebody can help me..
regards,
talkingtang
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
BTW: you have duplicate question at:
http://www.experts-exchang
I think you can delete it before any comment posted in it.
Suat
Business Accounts
Answer for Membership
by: smozgurPosted on 2003-08-19 at 03:43:24ID: 9179944
Hi talkingtang,
1-Goto VBA (Alt+F11) and point to Insert->Userform to create a new userform.
2- From the Control Toolbox (View->Toolbox in Form view) select Listbox control and draw a listbox on the form (default name is ListBox1)
3- From the Control Toolbox select CommandButton and draw a command button on the form (default name is CommandButton1). Goto properties window when listbox selected (hit F4) and set ListStyle Property as frmListStyleOption.
4- Point to View->Code (or hit F7) to see Form module and copy and paste the following code into the module which is appeared on right pane.
'----Code Start----
Private Sub UserForm_Activate()
'This code works when form is activated and fill the options in the list box
Me.ListBox1.AddItem "First choice"
Me.ListBox1.AddItem "Second choice"
Me.ListBox1.AddItem "Third choice"
End Sub
Private Sub CommandButton1_Click()
'This code works when CommandButton1 is clicked and call the related macros according to selected item index in listbox
Select Case Me.ListBox1.ListIndex
Case 0
Call Choice1Event
Case 1
Call Choice2Event
Case 2
Call Choice3Event
End Select
End Sub
Sub Choice1Event()
'Code works if first item is selected
MsgBox "Choice 1 event goes here"
End Sub
Sub Choice2Event()
'Code works if second item is selected
MsgBox "Choice 2 event goes here"
End Sub
Sub Choice3Event()
'Code works if third item is selected
MsgBox "Choice 3 event goes here"
End Sub
'----Code End----
5- Run the form by pressing F5
You can activate the form by using following code from your module in your real project.
Userform1.Show
I hope this helps.
Suat