Hang on a moment.
How many variables do you need to return?
If it is less than (say )6, there is a much simpler method,making use of the difference between ByRef and ByVal when passing parameters in.
There is probably an FAQ somewhere, but here is (I hope) a simple example of getting two values back from a function or subroutine (!)
Consider this:
Dim x as long
x = 6
Call DoSomething(x)
debug.print x
'(result is 9!!!)
Private Sub DoSomething( p as integer)
p=9
end sub
..if you try that you will find that x has a different value after the call.
This is because VB defaults to passing parameters ByRef - the equivalent of using pointers in C
In fact, to prevent this sort of thing, you have to EXPLICITY tell VB not to allow the values of parameters to change.
This is done using the ByVal condition.
Thus:
Dim x as long
x = 6
Call DoSomething(x)
debug.print x
'(result is that x is still 6 as you expected)
Private Sub DoSomething( ByVal p as integer)
p=9
end sub
So, to get multiple values back from a function of subroutine, try this sort of thing:
Dim inputVal as integer
Dim outputA as integer
Dim outputB as integer
Dim outputC as integer
inputVal = 12
Call Multival(inputVal, outputA,outputB,outputC)
debug.print outputA,outputB,outputC
Private sub MultiVal (inp as integer,A as integer,B as integer, C as integer)
A=inp * 2
B=inp * 3
C=inp * 4
End Sub