Did any of you tried to pass a ParamArray value to another function ?
It did not work, right ?
Here's what I mean:
Yes, I discovered the fix also, but I don't understand why it works:VB Code:
Option Explicit Private Sub Form_Load() Test1 1, 2, 3, 4, 5, 6 End Sub Private Sub Test1(ParamArray Values() As Variant) [COLOR=Red]Test2 Values[/COLOR] ' Gives error here End Sub Private Sub Test2(Vals As Variant) Debug.Print UBound(Vals) End Sub
Theoretically, doing this "Array(some_value)(0)" is the same as just some_value alone... why does that work I have no clue...VB Code:
Option Explicit Private Sub Form_Load() Test1 1, 2, 3, 4, 5, 6 End Sub Private Sub Test1(ParamArray Values() As Variant) Test2 Array(Values)(0) ' PROBLEM FIXED End Sub Private Sub Test2(Vals As Variant) Debug.Print UBound(Vals) End Sub




Reply With Quote