' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Function CombiHelp(prefix As String, posleft As Integer, maxno As Integer, start As Integer) As String
    Dim res As String
    Dim i As Integer
    res = ""
    For i = start To maxno - posleft + 1
        If posleft > 1 Then
            res = res & CombiHelp(prefix & i & ",", posleft - 1, maxno, i + 1)
        Else
            res = res & prefix & i & ")"
        End If
    Next
    CombiHelp = res
End Function

Function Combi(x As Integer, y As Integer) As String
    Combi = CombiHelp("(", x, y, 1)
End Function

Function TestCombi()
    MsgBox (Combi(3, 5))
End Function
