dan_l
Active Member
Hi,
This one is vexing me.
Class property:
Inputrange.value is a valid assignment set in class initialize.
The precursors seem to be ok:
Results in:
My range is $A$1:$C$21
My ubound for the array is 21
But:
Debug.Print "My first value in the array is" & vbTab & OPR.avInputs(1, 1)
Throws error:
"Compile Error: Wrong number of arguments or invalid property assignment"
It's got to be either:
A) I just can't do this (in my fucking around, I tried calling it Inside the class using me. and it didn't work either.
B) I'm missing a piece of syntax somewhere.
The only other hint I've got:
Within the sub if I create another array (dim avTest() as variant) and pull values from the one that's stored in the class (avtest = opr.avinputs) it seems to work ok, but I can't think of a reason why I wouldn't be able to reference it without the copy. That and for this specific application I could see this turning into a performance issue whereas the "test" version of the data is 20+ records, the real version is going to be quite a few more.
EDIT - I should add: the ultimate goal is to loop through the array within the class, not really in sub that calls it. I just did the explanation this way because I think it makes the problem a little bit easier to show.
This one is vexing me.
Class property:
Code:
Public Property Get avInputs() As Variant()
m_avInputs = Me.InputRange.value
avInputs = m_avInputs
End Property
Inputrange.value is a valid assignment set in class initialize.
The precursors seem to be ok:
Code:
Sub test()
Dim OPR As New cOutputRoutine
Debug.Print "My range is" & vbTab & OPR.InputRange.Address
Debug.Print "My ubound for the array is" & vbTab & UBound(OPR.avInputs, 1)
Results in:
My range is $A$1:$C$21
My ubound for the array is 21
But:
Debug.Print "My first value in the array is" & vbTab & OPR.avInputs(1, 1)
Throws error:
"Compile Error: Wrong number of arguments or invalid property assignment"
It's got to be either:
A) I just can't do this (in my fucking around, I tried calling it Inside the class using me. and it didn't work either.
B) I'm missing a piece of syntax somewhere.
The only other hint I've got:
Within the sub if I create another array (dim avTest() as variant) and pull values from the one that's stored in the class (avtest = opr.avinputs) it seems to work ok, but I can't think of a reason why I wouldn't be able to reference it without the copy. That and for this specific application I could see this turning into a performance issue whereas the "test" version of the data is 20+ records, the real version is going to be quite a few more.
EDIT - I should add: the ultimate goal is to loop through the array within the class, not really in sub that calls it. I just did the explanation this way because I think it makes the problem a little bit easier to show.