VB Code:
Private Sub Command1_Click()
Dim sLine() As String, sTitle As String, sValue As String
Dim x As Integer, y As Integer, z As Integer
sLine = Split(Text1, vbCrLf)
For x = 0 To UBound(sLine)
y = InStr(sLine(x), ":")
z = InStrRev(sLine(x), ":")
If y Then
sTitle = Trim$(Left$(sLine(x), y - 1))
sValue = Right$(sLine(x), Len(sLine(x)) - z)
sValue = Trim$(Replace(sValue, """", ""))
If sTitle = "SMSC number" Then
Text1 = sValue
ElseIf sTitle = "Remote number" Then
Text2 = sValue
End If
End If
Next x
End Sub
OR ..
VB Code:
Private Sub Command1_Click()
Dim sLine() As String, x As Integer
Dim sTitle As String, sValue As String
sLine = Split(Text1, vbCrLf)
For x = 0 To UBound(sLine)
Call GetLine(sLine(x), ":", sTitle, sValue)
If sTitle = "SMSC number" Then
Text1 = sValue
ElseIf sTitle = "Remote number" Then
Text2 = sValue
End If
Next x
End Sub
Private Sub GetLine(ByVal str As String, ByVal val As String, _
ByRef sTitle As String, ByRef sValue As String)
Dim y As Integer, z As Integer
y = InStr(1, str, val, 3): z = InStrRev(str, val, , 3)
If y Then
sTitle = Trim$(Left$(str, y - 1))
sValue = Right$(str, Len(str) - z)
sValue = Trim$(Replace(sValue, """", ""))
End If
End Sub
OR ..
VB Code:
Private Sub Command1_Click()
Dim sLine() As String, x As Integer
Dim sTitle As String, sValue As String
sLine = Split(Text1, vbCrLf)
For x = 0 To UBound(sLine)
sTitle = GetTitle(sLine(x), ":")
sValue = GetValue(sLine(x), ":")
If sTitle = "SMSC number" Then
Text1 = sValue
ElseIf sTitle = "Remote number" Then
Text2 = sValue
End If
Next x
End Sub
Private Function GetTitle(ByVal str As String, ByVal val As String) As String
Dim i As Integer: i = InStr(1, str, val, vbTextCompare)
If i Then GetTitle = Trim$(Left$(str, i - 1))
End Function
Private Function GetValue(ByVal str As String, ByVal val As String) As String
Dim i As Integer: i = InStrRev(str, val, , vbTextCompare)
If i Then GetValue = Trim$(Replace(Right$(str, Len(str) - i), """", ""))
End Function