![]() |
create dynamic comboboxes
Hello, is it possible to create dynamic combo boxes? I have an userform which saves the file into a specified folder. The user can choose one out of 4 predefined folders from a combobox. I want to add a button "Add folder", by what the user can enter the path and the folder would appear in the comobbox. The users are not proficient to fill the combobox via VBA and I want them to be able to add folders without proggramming. thank you Martin |
create dynamic comboboxes
If the combobox is populated using RowSource, then the code behind the command button would have to resize the row source range and add the new folder to the rowsource range. If the combobox is populated during the initialize event using the add item method, then the command button code can use the add item method to add the new folder to the combo box list as below. Private Sub CommandButton1_Click() ComboBox1.AddItem Selection End Sub This assumes the user will have typed a new folder name into a cell and then selects that cell. |
create dynamic comboboxes
if you have a text box above the listbox, and a button next to at , your user can tyep the address in the textbox then click the button the button's click event should be listbox1.AddItem Textbox1.text ' these next two are optional textbox1.text="" listbox1.listindex = listbox1.listcount-1 ' this clears the textbox and highlights the last row of the listbox. this though is akin to clicking the list box ...so don't use this if you're trapping the listbox click event "Martin" wrote in message ... Hello, is it possible to create dynamic combo boxes? I have an userform which saves the file into a specified folder. The user can choose one out of 4 predefined folders from a combobox. I want to add a button "Add folder", by what the user can enter the path and the folder would appear in the comobbox. The users are not proficient to fill the combobox via VBA and I want them to be able to add folders without proggramming. thank you Martin |
All times are GMT +1. The time now is 07:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com