Reputation: 220
I have a DLL (inaccessible at the moment) where a function returns a Variant()
This variant is theoretically should return an array of errors (if such occurred).
Dim iresult
iresult = object.functioncall()
I am trying to catch this result set whether it's empty or not. What I get right now is this:
?typename(iresult)
Variant()
?ubound(iresult)
1
?lbound(iresult)
0
?isempty(iresult)
False
?isnull(iresult)
False
?isarray(iresult)
True
Any attempt to get inside iresult(1) or iresult(0) or through a loop gives me a subscript out of range error. I can settle for array being empty but if it contains something i need to get it.
Any suggestions are welcome. Thank you.
Upvotes: 0
Views: 245
Reputation: 220
After accessing the code I have realized that part of the issue was that array being returned was 2 dimensional. But I cheated anyway, because the array can come empty and Variant would not recognize it being empty or null.
By reiterating through returned Variant (which always comes back as an array or sorts) I catch the "out out of range" error and go one with my code. If it does reiterate then I would be fine as well.
Thanks for your help.
Upvotes: 0