Option Compare Database
Public Function GetKeyCode(sText As String, sPrefix As String, num As Long) As String
Dim ns As Long
Dim chkflg As Boolean
Dim i As Long
Dim buf As String
buf = ""
ns = InStr(1, sText, sPrefix)
Do Until ns = 0
chkflg = True
For i = ns + 1 To ns + num
If IsNumeric(Mid(sText, i, 1)) = False Then
chkflg = False
Exit For
End If
Next i
If chkflg Then
If buf <> "" Then buf = buf & ","
buf = buf & Mid(sText, ns, num + Len(sPrefix))
End If
ns = InStr(ns + 1, sText, sPrefix)
Loop
GetKeyCode = buf
End Function