View Full Version : Retreiving the properties out of a class.

09-20-2012, 02:42 PM
Hi there.. Desperate coder here.

How in the heck do i just retrieve my variables that have been stored in a class? Why is this so frustrating to do?

Dim dinger As Variant
For c = 1 To 5
For r = 1 To UBound(entryList)
For Each dinger In entryList()
-> ERROR ActiveCell.value = dinger.day
with error 91 object variable or with block variable not set.

Here is the class code

Option Explicit
Private cDay As String ' duedate
'gets and sets begin here
Public Property Get day() As String
day = cDay
End Property
Public Property Let day(value As String)
cDay = value
End Property

the Entrylist variable is as such..
Global entryList() As ClassEntry
it has been re-dimmd over the course of the code to have roughly 3000 objects in it. My sets work fine...

Set entryList(classCount) = New ClassEntry 'create a new class entry
entryList(classCount).day = dates(r) 'set the date

where dates(r) is an array holding strings.

09-20-2012, 05:37 PM
Have you tried this line without parenthesis?
For Each dinger In entryList

09-20-2012, 08:05 PM
Got rid of the ()'s, same error.

09-21-2012, 02:08 AM
Dim dinger As Variant
For c = 1 To 5
For r = 1 To UBound(entryList)
set dinger = entrylist(r)
ActiveCell.value = dinger.day

09-21-2012, 02:37 AM
I'd use:

Sub tst()
ReDim entrylist(20)

For j = 0 To UBound(entrylist)
Set entrylist(j) = New ClassEntry
entrylist(j).day = Date + j

For j = 0 To UBound(entrylist)
x3 = entrylist(j).day
End Sub