Illegal pass by value: <argument name>
One of the following happened:
- In declaring or defining a function or sub, you used the ByVal
keyword in specifying a parameter that is an array, list, object reference,
or user-defined data type. Arrays, lists, instances of user-defined
data types, and object references cannot be passed by value, so ByVal
is not allowed in the specification of one of these as a parameter.
For example:
Type MyType A As Integer End Type Declare Function MyFunction(ByVal X As MyType) ' Illegal
Remove ByVal from the declaration.
- You tried to pass an array, list, object reference, or instance
of a user-defined data type by value in a call to a LotusScript® procedure. For example:
Type MyType A As Integer End Type Sub MySub(X As MyType) ' ... End Sub Dim Z As MyType MySub(Z) ' Illegal: this tries to pass by value. MySub Z ' Legal: this passes by reference.
or
Dim anArray(1 to 3) As String Sub MySub2(Z As Variant) ' ... End Sub MySub2(anArray()) ' Illegal: this tries to pass by value. MySub2 anArray() ' Legal: this passes by reference.
Pass the argument by reference. Remove the parentheses around the argument in the calling statement.