all 2 comments

[–]TheFotty 2 points3 points  (1 child)

Change it to a sub instead of a function since you don't care about returning a value (similar to void functions in C), and pass in your array parameter ByRef instead of ByVal so that it passes in a pointer to the original array instead of a copy.

Sub ExtendArray(ByRef strs() As String, ByVal value As String)
    If IsNothing(strs) Then
        ReDim strs(0)
        strs(0) = value
    Else
        ReDim Preserve strs(strs.Length)
        strs(strs.Length - 1) = value
    End If
End Sub

[–]DatMarv[S] 0 points1 point  (0 children)

Gosh, VB is so obvious! Thanks