tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,741
- Office Version
-
- 2019
- Platform
-
- Windows
Can someone please explain why this fails, with the message: Compile error: ByRef argument type mismatch
Instead, if I changed it to
it works.
Is it because I am originally passing through a variant, though it's expecting a string?
Thanks
(BTW: what is parse v pass)?
Code:
Option Explicit
Sub Main()
Dim MyFruits() As Variant
MyFruits= Array("Apples", "Oranges")
Dim MyFruitsCount As Variant
For Each MyFruitsCount In MyFruits
Call Sec(MyName:=MyFruitsCount)
Next MyFruitsCount
End Sub
Sub Sec(MyName As String)
End Sub
Instead, if I changed it to
Code:
Sub Sec(ByVal MyName As String)
it works.
Is it because I am originally passing through a variant, though it's expecting a string?
Thanks
(BTW: what is parse v pass)?
Last edited: