You can use a ParamArray to send an arbitrary number of arguments.
> To be honest, I don't know - a quick look at help turned up nothing.
>
[quoted text clipped - 23 lines]
>> > > 59, but I am wondering if that has changed. I don't see anything in
>> > > Help about this. Thanks.
Technically it's one argument that the procedure receives but, yes, the
number of elements is, AFAIK, unlimited (or, I suppose, limited only by the
maximum length of the calling statement).
--
Enjoy,
Tony
> You can use a ParamArray to send an arbitrary number of arguments.
>
[quoted text clipped - 25 lines]
> >> > > 59, but I am wondering if that has changed. I don't see anything in
> >> > > Help about this. Thanks.
Rick Charnes - 19 Oct 2005 16:18 GMT
I'm actually calling this Word macro from another application
(Powerbuilder) which installs Word as an OLE server and therefore allows
me to send commands to Word such as 'execute this macro'. Currently, I
call the macro from Powerbuilder with about 12 arguments and it works
great. I'd now like to add about 80 more (I know it sounds crazy...)
Tony, you mention that the number of elements is unlimited but you got
an error at 61? Maybe as you suggest the limit is the length of the
calling statement rather than the number of elements?
> Technically it's one argument that the procedure receives but, yes, the
> number of elements is, AFAIK, unlimited (or, I suppose, limited only by the
[quoted text clipped - 3 lines]
> Enjoy,
> Tony
Jezebel - 19 Oct 2005 22:14 GMT
Put your arguments into an array, and pass that as a single argument.
> I'm actually calling this Word macro from another application
> (Powerbuilder) which installs Word as an OLE server and therefore allows
[quoted text clipped - 14 lines]
>> Enjoy,
>> Tony
Rick Charnes - 20 Oct 2005 16:50 GMT
Thanks, how do I reference that in the VBA code? I looked up ParamArray
in Help and don't see anything.
> Put your arguments into an array, and pass that as a single argument.
>
[quoted text clipped - 7 lines]
> > an error at 61? Maybe as you suggest the limit is the length of the
> > calling statement rather than the number of elements?
Tony Jollans - 20 Oct 2005 18:12 GMT
Code your macro something like this
Sub mySub(ParamArray myArgs())
For n = LBound(myArgs) To UBound(myArgs)
' Do whatever you want with the n'th argument here
Next
End Sub
And call it with as many parameters as you like. ParamArray arrays always
have an LBound of zero and if they are empty they have a UBound of -1.
ParamArray is described in the help for the Sub statement
--
Enjoy,
Tony
> Thanks, how do I reference that in the VBA code? I looked up ParamArray
> in Help and don't see anything.
[quoted text clipped - 10 lines]
> > > an error at 61? Maybe as you suggest the limit is the length of the
> > > calling statement rather than the number of elements?