Alright, I am trying to load a bunch of info from an excel spreadsheet into a list. I made a class that holds all this crap for me. I work with C++ mostly and I just started using VBA this week, so the answer is probably simple, but for some reason the following code does not work:
Do Until ProgSheet.Cells(Row, 15).Text = ""
Dim NewProduct As New Product
NewProduct.Name = ProgSheet.Cells(Row, 15).Text
NewProduct.Row = Row
Products(Hash(Temp.Name)).Add (NewProduct)
Loop
Products has already been declared, it is a linked list of the Product class. But for some reason, there is an error on the line:
NewProduct.Name = ProgSheet.Cells(Row, 15).Text
It tells me <Object variable or With block variable not set>
Now this is supposed to be the same as a NULL reference exception in C++, it means that NewProduct isnt actually set to a Product. But isnt that what:
Dim NewProduct As New Product
is supposed to do?
What am I doing wrong here? I;ve tried changing it to:
Dim NewProduct as Product
Set NewProduct = New Product
But it won't even let me do the set, it comes up with the same error.