Is it really not possible to declare a 0-length array in VBA? If I try this:
Dim lStringArr(-1) As String
I get a compile error saying rang
Per Comintern's comment.
Make a dedicated utility function that returns the result of the VBA.Strings.Split
function, working off vbNullString
, which is effectively a null string pointer, which makes the intent more explicit than using an empty string literal ""
, which would also work:
Public Function EmptyStringArray() As String()
EmptyStringArray = VBA.Strings.Split(vbNullString)
End Function
Now branch your function to check for the existence of keys, and return EmptyStringArray
if there are none, otherwise proceed to resize your result array and convert each source element.