![]() |
ByRef argument type mismatch
I have two code modules, one named "Primary" and the other is "Utils".
'The "Utils" module has the following subroutine: '----------------------------------------------- Public Sub Foo (a as Integer, b as Integer) MsgBox "Nothing here." End Sub ' The "Primary module has the following subroutine: '------------------------------------------------- Public Sub Goo() Dim x, y as Integer x = 2 y = 3 Utils.foo x, y ' ByRef argument error here End Sub When you run the Goo() subroutine, you get the "ByRef argument type mismatch". What's wrong here? -Robert |
ByRef argument type mismatch
RG III wrote in :
I have two code modules, one named "Primary" and the other is "Utils". 'The "Utils" module has the following subroutine: '----------------------------------------------- Public Sub Foo (a as Integer, b as Integer) MsgBox "Nothing here." End Sub ' The "Primary module has the following subroutine: '------------------------------------------------- Public Sub Goo() Dim x, y as Integer x = 2 y = 3 Utils.foo x, y ' ByRef argument error here End Sub When you run the Goo() subroutine, you get the "ByRef argument type mismatch". What's wrong here? 'x' isn't (necessarily) an Integer, it's a Variant (unless there's a Deftype statement somewhere). You have to specify each variable's type to change it from the default: Dim x as Integer, y as Integer -- He felt emptied, a shell without emotions. Everything he touched brought death and grief. And it was like a disease that could spread across the universe. |
All times are GMT +1. The time now is 10:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com