' 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 CountSubStr(s As String, ss As String) As Integer
    Dim res As Integer
    Dim ix As Integer
    res = 0
    ix = 0
    Do
        ix = InStr(ix + 1, s, ss)
        If ix > 0 Then res = res + 1
    Loop Until ix <= 0
    CountSubStr = res
End Function

Function testcss()
    MsgBox Str(CountSubStr("Dette er en test", "t"))
End Function
