You Can't Pass an Expression as a Parameter that is Defined as ByRef Error

In a function call, you tried to pass an expression rather than a variable or property to a parameter that was declared as ByRef in the called method.


Example

The following method takes one parameter that was declared as ByRef:

Sub Squarit( ByRef c as Double)
 c=c*c

The calling function is:

Dim a,b as Double
a=5
b=10
Squarit(a*b) //cannot use an expression here

See Also

ByRef operator.