哦,好像明白了,前面我说的没错,将Test2改成: public sub test2(Byval ParamArray Args())
End sub
看看MSDN中Function的用法,有讲ParamArray关键字的。
'//Try it! Public sub Test1(ParamArray Args() As Variant) call test2()'???????????参数怎么写 End sub'//The array declared by the ParamArray keyword can only be of '//the Variant type.
我现在用极其愚蠢的方法来应付的。Public sub Test1(ParamArray Args()) select case ubound(args) case -1 call test2() case 0 call test2(Args(0)) case 1 call test2(Args(0), Args(1) case 2 call test2(Args(0), Args(1), Args(2)) case 3 call test2(Args(0), Args(1), Args(2), Args(3)) case 4 call test2(Args(0), Args(1), Args(2), Args(3), Args(4)) . . . . . . end select End sub 哎!苦命的我!
public sub test2(Byval ParamArray Args())
End sub
Public sub Test1(ParamArray Args() As Variant)
call test2()'???????????参数怎么写
End sub'//The array declared by the ParamArray keyword can only be of
'//the Variant type.
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~注意:Test2不能改动,Test1怎么改都行。谢谢!
case -1
call test2()
case 0
call test2(Args(0))
case 1
call test2(Args(0), Args(1)
case 2
call test2(Args(0), Args(1), Args(2))
case 3
call test2(Args(0), Args(1), Args(2), Args(3))
case 4
call test2(Args(0), Args(1), Args(2), Args(3), Args(4))
.
.
.
.
.
. end select
End sub
哎!苦命的我!
演示程序去小站下载.http://ygyuan.3322.net/
http://ygyuan.onchina.net/