Hi Guy's hoping you can help with this
the snip is a debug, when getting data from a text box
Salutation (ct)
First Name (fn)
Last Name(ln)
I am trying allsorts to remove these blocks such as Replace / LTrim strings
I have never seen this before!!, i have searched a few places and know you great people will know what these little blocks are ?
Code:
Dim ct() As String, sct As String, ict As Integer
ct = Split(strMailMessage, vbCrLf)
For ict = 0 To UBound(ct)
If InStr(1, ct(ict), "Salutation:") > 0 Then
sct = Mid(ct(ict + 2), 1) & vbCrLf & vbCrLf
Exit For
End If
Next ict
sct = LTrim(sct)
sct = Replace(sct, Chr(13) & Chr(10), "")
Me.txtName = LTrim(sct)
Dim fn() As String, sfn As String, ifn As Integer
fn = Split(strMailMessage, vbCrLf)
For ifn = 0 To UBound(fn)
If InStr(1, fn(ifn), "First Name:") > 0 Then
sfn = Mid(fn(ifn + 2), 1) & vbCrLf & vbCrLf
End If
Next ifn
sfn = LTrim(sfn)
sfn = Replace(sfn, Chr(13) & Chr(10), "")
Dim ln() As String, sln As String, strFN As String, iln As Integer
ln = Split(strMailMessage, vbCrLf)
For iln = 0 To UBound(ln)
If InStr(1, ln(iln), "Last Name:") > 0 Then
sln = Mid(ln(iln + 2), 1) & vbCrLf & vbCrLf
Exit For
End If
Next iln
sln = LTrim(sln)
Me.txtName = ""
Me.txtName = sct & " " & sfn & " " & sln
Me.txtName = Replace(Replace(Me.txtName, Chr(13) & Chr(10), ""), Chr(8), LTrim(Me.txtName))