Code:
Dim astrLines() As String, strBody As String, EmailAdd As String, LiftMake As String, StCu As String
Dim PCLine() As String, ContactNo() As String, ClientName() As String, SerialNo() As String, LiftType() As String, LModel() As String
Dim CLSearch() As String, LiftAge() As String
Dim L As Long, PC As Long, CN As Long, SN As Long, LB As Long, MD As Long, Tel As Long, Cont As Long, CL As Long, AOL As Long
Dim Mystr As String, fName As String, SName As String, cTitle As String
If Me.tbxPaste = False Then
If Me.txtMailMessage <> "" Then
strBody = Me.txtMailMessage
astrLines = Split(strBody, vbCrLf)
For L = 0 To UBound(astrLines)
If InStr(1, astrLines(L), "*Email Address:") > 0 Then
'MsgBox Mid(astrLines(L), 16)
Me.txtEmailTo = Mid(astrLines(L), 17)
End If
Next L
LiftAge = Split(strBody, vbCrLf)
For AOL = 0 To UBound(LiftAge)
If InStr(1, LiftAge(AOL), "Age Of Lift:") > 0 Then
Me.txtAgeOfLift = Mid(LiftAge(AOL), 14)
End If
Next AOL
CLSearch = Split(strBody, vbCrLf)
For CL = 0 To UBound(CLSearch)
If InStr(1, CLSearch(CL), "How did you hear about us?:") > 0 Then
Me.txtClientSearch = Mid(CLSearch(CL), 29)
End If
Next CL
ContactNo = Split(strBody, vbCrLf)
For Tel = 0 To UBound(ContactNo)
If InStr(1, ContactNo(Tel), "*Contact Number:") > 0 Then
Me.txtTel = Mid(ContactNo(Tel), 18)
End If
Next Tel
LModel = Split(strBody, vbCrLf)
For MD = 0 To UBound(LModel)
If InStr(1, LModel(MD), "Lift Type:") > 0 Then
StCu = Mid(LModel(MD), 12)
If Left(StCu, 3) = "str" Then
Me.tbxStraight = True
Me.tbxCurved = False
End If
If Left(StCu, 3) = "Cur" Then
Me.tbxStraight = False
Me.tbxCurved = True
End If
End If
Next MD
PCLine = Split(strBody, vbCrLf)
For PC = 0 To UBound(PCLine)
If InStr(1, PCLine(PC), "Post Code:") > 0 Then
'MsgBox Mid(PCLine(PC), 11)
Me.txtPostCode = Mid(PCLine(PC), 12)
End If
Next PC
ClientName = Split(strBody, vbCrLf)
For CN = 0 To UBound(ClientName)
If InStr(1, ClientName(CN), "*Name:") > 0 Then
Me.txtClientName = Mid(ClientName(CN), 8)
'End If
If Left(Me.txtClientName, 3) = "Mrs" Then
cTitle = Mid(ClientName(CN), 8, 3)
Me.cboClientTitle = cTitle
Me.txtClientName = Mid(txtClientName, 12)
End If
If Left(Me.txtClientName, 3) = "Miss" Then
cTitle = Mid(ClientName(CN), 8, 4)
Me.cboClientTitle = cTitle
Me.txtClientName = Mid(txtClientName, 13)
End If
If Left(Me.txtClientName, 3) = "Mr" Then
cTitle = Mid(ClientName(CN), 8, 3)
Me.cboClientTitle = cTitle
Me.txtClientName = Mid(txtClientName, 12)
End If
'If Left(Me.txtClientName, 4) = "Miss" Then
'cTitle = Left(Me.txtClientName, 4)
'Me.cboClientTitle = cTitle
'Me.txtClientName = Mid(Me.txtClientName, 6)
'End If
'If Left(Me.txtClientName, 2) = "Mr" Then
'cTitle = Left(Me.txtClientName, 2)
'Me.cboClientTitle = cTitle
'Me.txtClientName = Mid(Me.txtClientName, 4)
'End If
End If
Next CN
SerialNo = Split(strBody, vbCrLf)
For SN = 0 To UBound(SerialNo)
If InStr(1, SerialNo(SN), "Serial Number (if available):") > 0 Then
Me.txtSN = Mid(SerialNo(SN), 30)
Me.tbxGotSN = True
Else
Me.txtSN = ""
Me.tbxGotSN = False
End If
Next SN
LiftType = Split(strBody, vbCrLf)
For LB = 0 To UBound(LiftType)
If InStr(1, LiftType(LB), "Lift Brand:") > 0 Then
LiftMake = Mid(LiftType(LB), 13)
Me.txtBrand = LiftMake
End If
Next LB
End If
End If
4: Save mail