combo box empty after using .AddItem

G

Guest

I have a button on an excel spreadsheet that calls a form to filter existing
records. I managed to get the form to open but the items inside the combo
box are empty. I can select any of the empty spaces and still get the
formulas to work right (I placed a MsgBox command after I select the item so
I know there is information back there I just cant see it.

Here is the code I'm using:

Private Sub UserForm_Initialize()
'Populate Combo

m_cbIndustry.AddItem Text = "Automotive"
m_cbIndustry.AddItem Text = "Health"
m_cbIndustry.AddItem Text = "Industrial Equipment"
m_cbIndustry.AddItem Text = "Retail"
m_cbIndustry.AddItem Text = "Travel Services"
m_cbIndustry.Text = "Automotive"

End Sub

the "Automotive" which is the default shows up fine, the others are blank.
Any ideas how to fix this?
 
C

crispbd

Try this:
(remove the Text= portion of the additem)

Private Sub UserForm_Initialize()
'Populate Combo

m_cbIndustry.AddItem "Automotive"
m_cbIndustry.AddItem "Health"
m_cbIndustry.AddItem "Industrial Equipment"
m_cbIndustry.AddItem "Retail"
m_cbIndustry.AddItem "Travel Services"
m_cbIndustry.Text = "Automotive"

End Sub
 
G

Guest

I already tried that and the combo box is still blank, any other ideas I
might be able to try?
 
C

crispbd

I tried both your code and that which I supplied in the last message
The second worked. You might want to check to make sure the combo bo
you are trying to write to is in fact the one that is showing up on th
form
 
G

Guest

I deleted the whole thing and re-created it again and still the same problem.
Is there a setting I might be missing that causes them not to show up? Can
it be that the font is while or something?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top