I've just been playing around with a few different ideas:
Try out this sample code (should allow the user to return empty & non-empty typed arrays and parse through them without having to check for bounds or provide separate & more costly IsEmptyArray() type functions)
Option Explicit
Public Function myLongArray(Optional ByVal bEmpty As Boolean = False) As Long()
Dim lRet() As Long
If bEmpty Then
ReDim lRet(-1 To -1)
Else
ReDim lRet(1 To 2)
lRet(1) = 123
lRet(2) = 456
End If
myLongArray = lRet
End Function
Public Function myDoubleArray(Optional ByVal bEmpty As Boolean = False) As Double()
Dim dRet() As Double
If bEmpty Then
ReDim dRet(-1 To -1)
Else
ReDim dRet(1 To 2)
dRet(1) = 1.23
dRet(2) = 4.56
End If
myDoubleArray = dRet
End Function
Public Function myStringArray(Optional ByVal bEmpty As Boolean = False) As String()
Dim sRet() As String
If bEmpty Then
sRet = Split("", ":")
Else
ReDim sRet(1 To 2)
sRet(1) = "Ajay"
sRet(2) = "Ravalia"
End If
myStringArray = sRet
End Function
Public Sub myPrinter(ByVal str As String, ByVal myArr As Variant)
Dim i As Long
Debug.Print str & " contains:"
For i = Abs(LBound(myArr)) To UBound(myArr)
Debug.Print vbTab & myArr(i)
Next i
Debug.Print "End----------------" & vbCrLf
End Sub
Public Sub myMain()
myPrinter "Non-Empty Long Array", myLongArray
myPrinter "Empty Long Array", myLongArray(True)
myPrinter "Non-Empty Double Array", myDoubleArray
myPrinter "Empty Double Array", myDoubleArray(True)
myPrinter "Non-Empty String Array", myStringArray
myPrinter "Empty String Array", myStringArray(True)
End Sub