T
Terje
Hello Group. I have problems storing arrays in the application object.
First I create a string array and put it in an application variable:
Application("MyArray") = Split(RedFile(path), vbCrLf)
Then I create a class where one property is pointing to the variable above:
Class MyClass
Public Property Get MyArray(): MyArray= Application("MyArray"): End Property
End Class
Then I create an instance of the class:
Dim A: Set A = New MyClass
This way I can access all my application variables with the handy
A.MyArray, it's handy because it is short.
I am able to read UBound(A.MyArray) and typename(A.MyArray) returns
Variant(). But I can't access specific indexes like A.MyArray(0). This
throws error 450
Wrong number of arguments or invalid property assignment.
However, I found that when I copy the array into another variable aCopy
= A.MyArray, then I can access this array as I would expect. I read
somewhere on the Internet that the application object is implemented as
a collection, but why then can I read the UBound property? And why is
Variant() returned as typename?
terje
First I create a string array and put it in an application variable:
Application("MyArray") = Split(RedFile(path), vbCrLf)
Then I create a class where one property is pointing to the variable above:
Class MyClass
Public Property Get MyArray(): MyArray= Application("MyArray"): End Property
End Class
Then I create an instance of the class:
Dim A: Set A = New MyClass
This way I can access all my application variables with the handy
A.MyArray, it's handy because it is short.
I am able to read UBound(A.MyArray) and typename(A.MyArray) returns
Variant(). But I can't access specific indexes like A.MyArray(0). This
throws error 450
Wrong number of arguments or invalid property assignment.
However, I found that when I copy the array into another variable aCopy
= A.MyArray, then I can access this array as I would expect. I read
somewhere on the Internet that the application object is implemented as
a collection, but why then can I read the UBound property? And why is
Variant() returned as typename?
terje