Hi guys,
I created UDF using paramArray expecting I can use as many params I want (the function will be used under Excel 2003/7/10). However once I exceed 29 params I get an error message
"More arguments have been specified for this function that are allowed in the current file format"
is there any workaround, is number of args in the ParamArray really limited?
here is my funtion (shorten)
Function dwhBAL(ParamArray Params() As Variant) As Variant
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordse
With cnn
.ConnectionString = conString
.CursorLocation = adUseClient
.Open
End With
For i = LBound(Params) To UBound(Params)
Select Case UCase(Params(i))
Case "ACCOUNT", "ACC": thisPodminka
.......
rst.Open dwhBAL, cnn, adOpenStatic, 3 'adLockReadOnly
varData = rst.GetRows()
ReDim varDataT(1 To UBound(varData, 2) + 1, 1 To UBound(varData, 1) + 1)
dwhBAL = Nz(mySum + varData(0, 0))
End function
thank you
I created UDF using paramArray expecting I can use as many params I want (the function will be used under Excel 2003/7/10). However once I exceed 29 params I get an error message
"More arguments have been specified for this function that are allowed in the current file format"
is there any workaround, is number of args in the ParamArray really limited?
here is my funtion (shorten)
Function dwhBAL(ParamArray Params() As Variant) As Variant
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordse
With cnn
.ConnectionString = conString
.CursorLocation = adUseClient
.Open
End With
For i = LBound(Params) To UBound(Params)
Select Case UCase(Params(i))
Case "ACCOUNT", "ACC": thisPodminka
.......
rst.Open dwhBAL, cnn, adOpenStatic, 3 'adLockReadOnly
varData = rst.GetRows()
ReDim varDataT(1 To UBound(varData, 2) + 1, 1 To UBound(varData, 1) + 1)
dwhBAL = Nz(mySum + varData(0, 0))
End function
thank you