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 Type Mismatch" Error" .Is it because of the spread issue? I am removing some functionality from a already existing vb project So is it because i might have commented out some functionality. Kindly.Kindly provide your valuable suggestion.Thanks in advance.I am running the application in windows 7
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.