Scot,
My fault your first test didn't work. As I mentioned in the first post, Paramarray is only needed when the calling procedure may pass a variable/unknown number of arguments, but in implementing, I made the requirement greater than 0.
If UBound(arrX, 1) > 0 Then
Now, I you are always going to pass only one argument then skip Paramarray and just past the argument. The code is much simpler:
Private Sub LoadForm()
Dim oFrm As UserForm1
Dim A, B
A = Split("1,2,3", ",") 'First variant array
B = Array(1, 2, 3, 4, 5) 'Second variant array
Set oFrm = New UserForm1
With oFrm
populateListbox .ListBox1, A, B 'Pass ListBox1 and both variant arrays to load routine using a ParamArray
populateListboxII .ListBox2, B 'Pass .LIstBox2 and single array to other load routine that is much simpler.
.Show
End With
lbl_Exit:
Exit Sub
End Sub
Sub populateListbox(oList As MSForms.ListBox, ParamArray arrX() As Variant)
'ParamArray is used when an unknown (or variable) number of arguments can be passed
'Functions typically return a value. Since this routine does not is doesn't need to be a function.
Dim lngParam As Long
Dim lngIndex As Long
oList.Clear
For lngParam = 0 To UBound(arrX, 1)
For lngIndex = 0 To UBound(arrX(lngParam))
oList.AddItem CStr(arrX(lngParam)(lngIndex))
Next lngIndex
Next lngParam
lbl_Exit:
Exit Sub
End Sub
Sub populateListboxII(oList As MSForms.ListBox, X As Variant)
oList.List = X
lbl_Exit:
Exit Sub
End Sub