Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to use a UserForm for the first time and I am having a few
problems. I have managed to create a ComboBox and populate it. I have managed to show and unload the UserForm, but I just can't seem to get the data selected by the combobox. What have I done wrong? Sub testuform() Dim CBSel WRContactList.Show Dim ctl As Control For Each ctl In Me.Controls If ctl.Name = "ComboBox1" Then CBSel = ctl.Text End If Next ctl MsgBox CBSel End Sub -- Trefor |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Where are you putting this code? If the user closes the form by
clicking the 'X' button at the top left of the form, the form is unloaded and all its controls are cleared. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Trefor" wrote in message ... I am trying to use a UserForm for the first time and I am having a few problems. I have managed to create a ComboBox and populate it. I have managed to show and unload the UserForm, but I just can't seem to get the data selected by the combobox. What have I done wrong? Sub testuform() Dim CBSel WRContactList.Show Dim ctl As Control For Each ctl In Me.Controls If ctl.Name = "ComboBox1" Then CBSel = ctl.Text End If Next ctl MsgBox CBSel End Sub -- Trefor |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I had this code in a module, so I take it that is the problem?
How do I trap the X being hit? -- Trefor "Chip Pearson" wrote: Where are you putting this code? If the user closes the form by clicking the 'X' button at the top left of the form, the form is unloaded and all its controls are cleared. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Trefor" wrote in message ... I am trying to use a UserForm for the first time and I am having a few problems. I have managed to create a ComboBox and populate it. I have managed to show and unload the UserForm, but I just can't seem to get the data selected by the combobox. What have I done wrong? Sub testuform() Dim CBSel WRContactList.Show Dim ctl As Control For Each ctl In Me.Controls If ctl.Name = "ComboBox1" Then CBSel = ctl.Text End If Next ctl MsgBox CBSel End Sub -- Trefor |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
ComboBox list reliant on the entry from a different ComboBox | Excel Programming | |||
ComboBox | Excel Programming | |||
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox | Excel Programming | |||
Populating combobox from another combobox | Excel Programming |