-
Is it possible that a sub or a function could handle
an UNKNOWEN number of parameters .
like this :
Call quest(parameter1,parameter2,parameter3,parameter4...)
private sub quest(???????????????????)
end sub
I know that it could be done on C ,using pointers and stuf.
-
You can send a subroutine an array with an unknown amount of elements
Code:
Sub GetArray(Test() as String)
Dim L as Integer
For L=Lbound(Test) to Ubound(Test)
Debug.Print Test(L)
Next L
End Sub
'Then call it like this...
Dim ArrayName(12) as String
GetArray ArrayName()
-
well,as far as i know..
12 is a knoen number ,what would happen if the COM user
will send 13 parameters ?
-
Sorry, I just used 12 as an example. It could be 200 if you wanted.
-
You Can Do it but all the arguments have to be variants, use the paramarray keyword, like this
Code:
Public Sub MyFunction(ParamArray Arguments())
Dim i As Integer
For i = LBound(Arguments) To UBound(Arguments)
MsgBox Arguments(i)
Next i
End Sub
then you can
Code:
MyFunction "Have", "As", "Many", "Arguments", "As", "You", "Want"
-
Thanks Sam. You learn something new every day.
-
cool
Very helpfull, this is what i was looking for .