myArray = Array("A", "B", "C", "D", "E")
Call someSub(myArray)
...
Sub someSub(ByRef myArray() as String) 'Error here
'contents here
End Sub
Type mismatch error on that second part -- what's causing it?
Did you by any chance omit to use Option Explicit and then went on to not specify myArray's type ? That will make it a variant and you are saying as String which is indeed a type mismatch.
Option Explicit allows you to create variables on the fly without explicitly declaring them. This opens up bug like this one. You should put Option Explicit at the top of every VBA project. There's even an option for this.Should really be using option explicit and then defining all of your variables as specific types. In this case:
Option Explicit
Dim myArray(1 to 10) as String 'define the number of elements before you use it.
myArray(1) = 'A'
myArray(2) = 'B'
[etc etc]
It's a bit longer, but being type safe will make your code run faster and make it much easier to read. It also prevents errors like the one you've run into...