Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I created a collection based on the code in the thread titled "Class Instance
Identifier". On my Sheet1 I have a command button CommandButtonMainAddaModel that starts a UserForm UserForm1. UserForm1 has a textbox TextBox1 and two command buttons CommandButtonAddModel and CommandButtonCancelAddModel. The CommandButtonAddModel calls AddModeltoCollection from Module1. Sub AddModeltoCollection() Dim clsVar As Class1 Set clsVar = New Class1 clsVar.Model = UserForm1.TextBox1.Value StoreObject clsVar, clsVar.Model End Sub Sub StoreObject(cObject As Class1, sName As String) If modelClass Is Nothing Then Set modelClass = New Collection End If modelClass.Add cObject, sName End Sub Class1 has several properties including Model which is the key property. I am trying to display the list of Model key names in a listbox in a new form called UserFormModelListDisplay. Thread titled Object Required Error 8/22/05 is related to my problem. I have a type mismatch in the following code trying to AddItem the Model properties to the ListBox1. See the following code. Also it appears that the collection is lost when UserForm1 is unloaded. This may or may not be the case as I have not been able to successfully list the property. Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem mItem Next mItem UserFormModelListDisplay.Show End Sub Any help here would be greatly appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
data collection | Excel Discussion (Misc queries) | |||
code to add a name to the names collection and assign a reference | Excel Programming | |||
Collection | Excel Programming | |||
Collection Variable | Excel Programming | |||
sheet collection | Excel Programming |