![]() |
Object Required Error
Would I get this error if I was trying to fill a Listbox with values from a
collection and the collection was empty? |
Object Required Error
Post the code that is causing the error.
-- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
Private Sub UserFormModelListDisplay_Initialize()
Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
Shouldn't
UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
I am getting a type mismatch in that same line now. Thanks for catching that
little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
What is modelClass a collection of? mItem is just an object within the
collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
What data type is mItem?
-- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
That was a big help. All I had to do was add .Model at the end of my mItem
to get the key property of my Collection. Question though, will I loose my collection when the file is closed or will the collection always remain as it is created? I reposted my problem with a complete explanation in Thread Collection Code. Thanks for your help!!! "Jim Thomlinson" wrote: What is modelClass a collection of? mItem is just an object within the collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
Jim answered my question with mItem (being an object) was incomplete. I
needed to add .Model to get the correct property of the object. Thank you for your help. "Chip Pearson" wrote: What data type is mItem? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
You'll lose the collection object when the workbook is closed.
-- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... That was a big help. All I had to do was add .Model at the end of my mItem to get the key property of my Collection. Question though, will I loose my collection when the file is closed or will the collection always remain as it is created? I reposted my problem with a complete explanation in Thread Collection Code. Thanks for your help!!! "Jim Thomlinson" wrote: What is modelClass a collection of? mItem is just an object within the collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
Is it possible to store the collection in such a manner that I don't loose
it? Ever?? Thanks again "Chip Pearson" wrote: You'll lose the collection object when the workbook is closed. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... That was a big help. All I had to do was add .Model at the end of my mItem to get the key property of my Collection. Question though, will I loose my collection when the file is closed or will the collection always remain as it is created? I reposted my problem with a complete explanation in Thread Collection Code. Thanks for your help!!! "Jim Thomlinson" wrote: What is modelClass a collection of? mItem is just an object within the collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
No, all objects in memory are lost when the workbook is closed.
You could write out everything to a worksheet. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Is it possible to store the collection in such a manner that I don't loose it? Ever?? Thanks again "Chip Pearson" wrote: You'll lose the collection object when the workbook is closed. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... That was a big help. All I had to do was add .Model at the end of my mItem to get the key property of my Collection. Question though, will I loose my collection when the file is closed or will the collection always remain as it is created? I reposted my problem with a complete explanation in Thread Collection Code. Thanks for your help!!! "Jim Thomlinson" wrote: What is modelClass a collection of? mItem is just an object within the collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
In order to keep the object you need to write the values to a sheet when the
program exits and read them back in the next time the program is started. There is no way to just save the object. -- HTH... Jim Thomlinson "Cody" wrote: Is it possible to store the collection in such a manner that I don't loose it? Ever?? Thanks again "Chip Pearson" wrote: You'll lose the collection object when the workbook is closed. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... That was a big help. All I had to do was add .Model at the end of my mItem to get the key property of my Collection. Question though, will I loose my collection when the file is closed or will the collection always remain as it is created? I reposted my problem with a complete explanation in Thread Collection Code. Thanks for your help!!! "Jim Thomlinson" wrote: What is modelClass a collection of? mItem is just an object within the collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
Thank you for your replies. I will work on the writing to the sheet now.
"Jim Thomlinson" wrote: In order to keep the object you need to write the values to a sheet when the program exits and read them back in the next time the program is started. There is no way to just save the object. -- HTH... Jim Thomlinson "Cody" wrote: Is it possible to store the collection in such a manner that I don't loose it? Ever?? Thanks again "Chip Pearson" wrote: You'll lose the collection object when the workbook is closed. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... That was a big help. All I had to do was add .Model at the end of my mItem to get the key property of my Collection. Question though, will I loose my collection when the file is closed or will the collection always remain as it is created? I reposted my problem with a complete explanation in Thread Collection Code. Thanks for your help!!! "Jim Thomlinson" wrote: What is modelClass a collection of? mItem is just an object within the collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
Object Required Error
Make the sheet xlVeryHidden so that no one accidentally (on purpose) goes in
and mucks it up for you. -- HTH... Jim Thomlinson "Cody" wrote: Thank you for your replies. I will work on the writing to the sheet now. "Jim Thomlinson" wrote: In order to keep the object you need to write the values to a sheet when the program exits and read them back in the next time the program is started. There is no way to just save the object. -- HTH... Jim Thomlinson "Cody" wrote: Is it possible to store the collection in such a manner that I don't loose it? Ever?? Thanks again "Chip Pearson" wrote: You'll lose the collection object when the workbook is closed. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... That was a big help. All I had to do was add .Model at the end of my mItem to get the key property of my Collection. Question though, will I loose my collection when the file is closed or will the collection always remain as it is created? I reposted my problem with a complete explanation in Thread Collection Code. Thanks for your help!!! "Jim Thomlinson" wrote: What is modelClass a collection of? mItem is just an object within the collection. You need to specify what exactly you want from the object. For example if modelClass is a collection of sheets then mItem is a sheet. You can't add a sheet to a list box but you can add it's name. If you want to add the sheet name then it should be mItem.Name -- HTH... Jim Thomlinson "Cody" wrote: I am getting a type mismatch in that same line now. Thanks for catching that little blunder. I appreciate any additional help. "Chip Pearson" wrote: Shouldn't UserFormModelListDisplay.ListBox1.AddItem Item be UserFormModelListDisplay.ListBox1.AddItem mItem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Private Sub UserFormModelListDisplay_Initialize() Dim mItem As Variant Load UserFormModelListDisplay For Each mItem In modelClass UserFormModelListDisplay.ListBox1.AddItem Item Next mItem UserFormModelListDisplay.Show End Sub "Chip Pearson" wrote: Post the code that is causing the error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Cody" wrote in message ... Would I get this error if I was trying to fill a Listbox with values from a collection and the collection was empty? |
All times are GMT +1. The time now is 05:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com