参数调用的问题
问题1:一个子函数返回多个输出参数,如何分别调用?
例如:aaa(Xwmin As Integer, Ywmax As Integer, Ywmin As Integer, n As Integer, x() As Integer, y() As Integer)
这里前三个参数是输入参数,后三个是输出参数
问题2:子函数的参数能不能设置为数组?如何设置,如何调用?
就像上面的例子中,后两个参数分别定义了数组参数,但是不能定义这个数组的具体长度,而且如何得到这个子函数返回的x()和y()??
谢谢!
[解决办法]
Private Sub Command1_Click()
Dim intData() As Integer
ReDim intData(3)
Call aaa( "Hello ", intData)
Call MsgBox( "输出参数(传址型): " & intData(1))
End Sub
Private Sub aaa(ByVal strMsg As String, ByRef iData() As Integer)
ReDim iData(2)
Call MsgBox( "输入参数(传值型): " & strMsg)
iData(1) = 1
End Sub