Using VB6 how to get caller ID info using MScomm with USB voice Modem?

Date: Thu-Nov-30-2017-
Here is modified version of what i found online and made it work better - copy and paste and text1 to text4, timer1, and mscomm

Option Explicit
Dim endloopnow As Boolean
'' modifed version aspenx
Dim theportis As Integer
Dim Inp As String, ds As String
Dim l1 As String, l2 As String, l3 As String, l4 As String
Dim rk As String, sk As String
Dim da As String, ti As String, na As String, nu As String

Private Sub Form_Load()
    'Set modem commport
    MSComm1.CommPort = Text5.Text
    'Set modem Baud rate,Parity,Data bit, stop bit
    MSComm1.Settings = "9600,N,8,1"
    MSComm1.InputLen = 0
    'Open port
    MSComm1.PortOpen = True
    'Sends Caller ID string to the modem
    MSComm1.output = "AT+VCID=1" + Chr$(13)
    MSComm1.output = "+++"
  ' MSComm1.Output = "ATDT 5551234" & vbCrLf

End Sub

Private Sub GetInfo()


    'This line below will take you to the WF sub(wait for data)
    'In my case I am waiting for ("DATE") because this will be
    'the first section of data to be displayed when a call comes in.
    'Look in the OnComm sub to see what incoming data looks like
   ' wf ("DATE")
    'After the call comes in do some instringing
    'and some midstringing and wala, you have your
    'Caller Id info in a box. Im sure the lines
    'below are really ugly. But hey, works for me :)
Call MSComm1_OnComm
    'After all this call stuff, refresh the callerd id string.
    MSComm1.output = "AT+VCID=1" + Chr$(13)
    'Takes to back to pretty much the top of this sub just
    'to wait for another call!
    'If endloopnow = False Then
    'GoTo waitagain
    'Unload Me
    'End If
End Sub

Private Sub wf(w As String)
    'Input Variable
    Inp = ""
    'What this does is waits for a call. When ever a call
    'comes in, the data that is put into the buffer
    'starts with DATE so it is looking instr(inp,w)
    While InStr(Inp, w) = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
endloopnow = True
End Sub

Private Sub MSComm1_OnComm()
Dim FoundIt As Integer
    'When info comes into the buffer, give it a
    'name and debug.print.
   ' MsgBox MSComm1.Input '= "OK" Then
      Inp = ""
    ds = ""
    If MSComm1.InBufferCount > 0 Then ds = MSComm1.Input
    If ds <> "" Then Inp = Inp & ds
    Debug.Print ds
    FoundIt = InStr(1, ds, "DATE")

If FoundIt <> 0 Then
    l1 = InStr(1, Inp, "DATE =")
    l2 = InStr(1, Inp, "TIME =")
    l3 = InStr(1, Inp, "NAME =")
    l4 = InStr(1, Inp, "NMBR =")
    rk = InStr(l3, Inp, Chr$(13))
    sk = InStr(l4, Inp, Chr$(13))
    da = Mid(Inp, l1 + 7, 4)
    ti = Mid(Inp, l2 + 7, 4)
    na = Mid(Inp, l3 + 7, rk - (l3 + 7))
    nu = Mid(Inp, l4 + 7, sk - (l4 + 7))
    Text1.Text = na
    Text2.Text = nu
    Text3.Text = ti
    Text4.Text = da
    MsgBox Inp
    End If
    'This is what the imcoming info will look like
    'Date = 0321
    'Time = 1847
    'NAME = Callers Name
    'NMBR = 1234567890
End Sub

Private Sub Timer1_Timer()
    Call GetInfo
End Sub

[d] By: brandish
Date: Thu-Nov-30-2017
What is 1 + 100

Just Updated::