CodeItBetter Programming Another VB Programming Blog

How to accept any number of arguments in a function

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
'Coding Basics - How to accept any number of arguments in a function
You can implement a routine that accepts any number of arguments using the ParamArray keyword
 
Function Sum(ParamArray args() As Variant) As Double
    Dim I As Integer
    ' All ParamArrays are zero-based.
    For I = 0 To UBound(args)
        Sum = Sum + args(I)
    Next
End Function
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.