Syntax |
...,ByRef parameter,... |
Description |
Used within the Sub...End Sub, Function...End Function, or Declare statement to specify that a given parameter can be modified by the called routine. |
Comments |
Passing a parameter by reference means that the caller can modify that variable's value. Unlike the ByVal keyword, the ByRef keyword cannot be used when passing a parameter. The absence of the ByVal keyword is sufficient to force a parameter to be passed by reference: MySub ByVal I '<-- Pass i by value. MySub ByRef
i '<-- Illegal (will not
compile). |
Example |
Sub Test(ByRef a As Variant) a = 14 Sub Main() b = 12 |
See Also |
B |