I am new to VB6 and spread.My VB project is making using of spread .In forms wherever the spread initialization is done,VB 6 is throwing a compile error as \"By Ref Argument
The "ByRef Argument Type Mismatch" error occurs when you are passing a parameter to a function that is using ByRef
(the default) and the data type does not match what is expected.
Private Sub MyMethod(ByRef Value As String)
...
End Sub
Private Sub OtherMethod()
Dim Value As Integer
MyMethod Value
End Sub
Note that Value is declared as Integer
but the parameter is declared as String
, and as such are a mismatched.
Either correct the data types to match (Which way depends on what they are and their use), change the parameter to ByVal
, or do both (the best option unless you explicitly want to use ByRef
).
If the calling code is not yours, then it's possible that the By...
was ommited resulting in the VB6 default of ByRef
even if it wasn't deliberate.