Reputation: 633
I have a Let property defined as:
Public Property Let Set_ChanArray_Enabled1(i As Integer, j As Integer, choice As Boolean)
ChanArray(i, j).Enabled1 = choice
End Property
In a sub defined in the same object module, I attempt to do the following:
For j = 4 To 44
Me.Set_ChanArray_Enabled1(j, 1) = True
Me.Set_ChanArray_Enabled1(j, 3) = True
Next j
But VBE gives me a ByRef argument mismatch pointing to the j passed into
Me.Set_ChanArray_Enabled1(j, 1) = True
I have defined both j and the parameter passed into the method as integers so I am not sure what is wrong.
Upvotes: 2
Views: 9867
Reputation: 175816
That error indicates something is wrong with the typing of j
(i.e its not of type integer).
Have you declared it in a statement like; dim j, i as integer
? If so then only i
is an integer (you need to repeat as integer
).
(Using byval
appears to "fix" this because its pass-by-copy semantics allow VBA to perform an automatic type conversion to integer before calling Set_ChanArray_Enabled1
).
Upvotes: 4