-
Retreiving the properties out of a class.
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?
[vba]
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
[/vba] with error 91 object variable or with block variable not set.
Here is the class code
[vba]
Option Explicit
Private cDay As String ' duedate
'gets and sets begin here
'Day
Public Property Get day() As String
day = cDay
End Property
Public Property Let day(value As String)
cDay = value
End Property
[/vba]
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...
[vba]
Set entryList(classCount) = New ClassEntry 'create a new class entry
entryList(classCount).day = dates(r) 'set the date
[/vba]
where dates(r) is an array holding strings.
-
Have you tried this line without parenthesis?
[vba]For Each dinger In entryList[/vba]
-
Got rid of the ()'s, same error.
-
Perhaps:
[vba]Dim dinger As Variant
For c = 1 To 5
For r = 1 To UBound(entryList)
set dinger = entrylist(r)
ActiveCell.value = dinger.day [/vba]
-
I'd use:
[vba]
Sub tst()
ReDim entrylist(20)
For j = 0 To UBound(entrylist)
Set entrylist(j) = New ClassEntry
entrylist(j).day = Date + j
Next
For j = 0 To UBound(entrylist)
x3 = entrylist(j).day
Next
End Sub
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules