ComboBox with an editable function

  • Thread starter Thread starter bostonlady
  • Start date Start date
B

bostonlady

Does anyone know how to create a list box to allow the user to choos
AND allow the user to enter new data if he/she selects one item fro
the list? For example "other" would allow the user to add an item
 
When "other" is clicked, some entry field component of some sort becomes visible, maybe
even modal, and when entry there is complete, this entry gets transferred to the listbox
and selected. It takes several components and some VBA of coding to do since you can't
type into a listbox.
 
Would you happen to know where I might find a code example to do this?

Thank yo
 
This is a quite primitive solution, using Windows' inputbox:

Private Sub ListBox1_Click()
Dim S As String
If ListBox1.Text = "Other" Then
S = InputBox("Enter new item:")
If S <> "" Then _
ListBox1.AddItem S, _
ListBox1.ListIndex
End If
End Sub
 

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

Back
Top