hunter21188
12-14-2015, 12:43 PM
I have many different Modules that need to call a list of options to add to a dropdown box. I am trying to figure out how I can add what is essentially a dictionary with a list of items to add to a dropdown in one module, and then call that module for the certain dropdown boxes in other modules. Here is an example:
In my "Dictionary" module I have this list:
Item 1, Item 2, Item 3, Item 4...
In another module I want to add this list to ComboBox3, for example. But in another module I want to populate both ComboBox1 and ComboBox2 with this list, etc.
Any ideas?
Here is something I tried, but doesn't work...
In the dictionary module:
Public sub AllOptions()
'This is a list of all the possible ComboBoxes throughout all modules.
ComboBoxList = Array(CStr(ComboBox1), CStr(ComboBox2), CStr(ComboBox3), CStr(ComboBox4), CStr(ComboBox5))
For Each Ky In ComboBoxList
On Error Resume Next
If Ky.Listbox = 0 Then
With Ky
.AddItem "Item 1"
.AddItem "Item 2"...
End With
End If
Next
End Sub
Then in the module that I want to call this I have:
Private Sub ComboBox2_DropButtonClick()
Call Module9.AllOptions
End Sub
Thanks!
In my "Dictionary" module I have this list:
Item 1, Item 2, Item 3, Item 4...
In another module I want to add this list to ComboBox3, for example. But in another module I want to populate both ComboBox1 and ComboBox2 with this list, etc.
Any ideas?
Here is something I tried, but doesn't work...
In the dictionary module:
Public sub AllOptions()
'This is a list of all the possible ComboBoxes throughout all modules.
ComboBoxList = Array(CStr(ComboBox1), CStr(ComboBox2), CStr(ComboBox3), CStr(ComboBox4), CStr(ComboBox5))
For Each Ky In ComboBoxList
On Error Resume Next
If Ky.Listbox = 0 Then
With Ky
.AddItem "Item 1"
.AddItem "Item 2"...
End With
End If
Next
End Sub
Then in the module that I want to call this I have:
Private Sub ComboBox2_DropButtonClick()
Call Module9.AllOptions
End Sub
Thanks!