我想通过引用测试传递并在访问中传递值,但它不起作用。
Sub passByRef(ByRef a As Integer)
a = a + 1
End Sub
Sub passByVal(ByVal a As Integer)
a = a + 1
End Sub
Private Sub cmdByRef()
Dim i as Integer
i = 10
passByRef i
MsgBox i
End Sub
Private Sub cmdByVal()
Dim i as Integer
i = 10
passByVal i
MsgBox i
End Sub
在传递给它时它并没有声明它是通过引用函数传递的。有什么想法吗?
答案 0 :(得分:1)
maybe you should do this.
Private Sub cmdByRef()
Dim i as Integer
i = 10
passByRef i
MsgBox "Result of passByRef " + i
End Sub
Private Sub cmdByVal()
Dim i as Integer
i = 10
passByVal i
MsgBox "Result of passByVal " + i
End Sub