Byref Argument Type Mismatch In Vba Code Example


Example: 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

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable