ByRef argument type mismatch

   

An argument passed ByRef ( by reference), the default, must have the precise data type expected in the procedure. This error has the following cause and solution:

Note   If you don't specify a type for a variable, the variable receives the default type, Variant. This isn't always obvious. For example, the following code declares two variables, the first, MyVar, is a Variant; the second, AnotherVar, is an Integer.

Dim MyVar, AnotherVar As Integer

For additional information, select the item in question and press F1.