Answers for "ByRef argument type mismatch"

1

ByRef argument type mismatch

' 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.
Sub main()  
    Dim MyVar, AnotherVar As Integer ' MyVar->Variant, AnotherVar->Integer
    'Dim MyVar As Integer, AnotherVar As Integer ' Both are declared integers
    MyVar = 3.1415 
    Call SomeSub((MyVar)) 
End Sub
Sub SomeSub (MyNum As Integer) 
    MyNum = MyNum + MyNum 
End Sub
Posted by: Guest on July-27-2020

Code answers related to "ByRef argument type mismatch"

Browse Popular Code Answers by Language