MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Sub editten(mai As Variant) Dim para As Variant Dim strArray() As String Dim nuMai As Object Dim strSearchFor() As Variant: strSearchFor = Array("Email:", "Shipping Company:", "Tracking Number:", "Estimated Arrival Date:", "Contact:", "Company Name:") Dim strResults() As String Dim elem As Integer Const str2 As String = "" Const str3 As String = "" Const str4 As String = "" ReDim strResults(UBound(strSearchFor)) ' If TypeName(Application.ActiveWindow) = "Explorer" Then ' Set mai = Application.ActiveExplorer.Selection.item(1) ' ElseIf TypeName(Application.ActiveWindow) = "Inspector" Then ' Set mai = Application.ActiveInspector.CurrentItem ' Else ' Exit Sub ' End If With mai strArray = Split(.Body, vbCrLf) For Each para In strArray If para <> "" Then For elem = LBound(strSearchFor) To UBound(strSearchFor) If LCase(Left(para, Len(strSearchFor(elem)))) = LCase(strSearchFor(elem)) Then strResults(elem) = Trim(Split(para, ":")(1)) Next End If Next End With ' Set mai = Nothing ' If strResults(0) = "" Then Exit Sub ' Only proceed if we have an email address! Set nuMai = Application.CreateItem(olMailItem) With nuMai .To = strResults(0) .Subject = "TLN Trade Company Inc - " & strResults(5) & " Your Order has now been shipped by UPS delivery" .Body = "Dear " & Split(strResults(4) & " ", " ")(0) & "," & vbCrLf & vbCrLf & _ "Your order has now been shipped with UPS and is due on to arrive on " & strResults(3) & ". " & _ "The tracking number for this order is " & strResults(2) & "." & vbCrLf & vbCrLf & _ "To check the status of this delivery: " & vbCrLf & vbCrLf & _ "1. Go to http://www.ups.com/tracking/tracking.html" & vbCrLf & _ "2. Enter the tracking number above in the Tracking or InfoNotice Numbers Box" & vbCrLf & _ "3. Press the Track Button" & vbCrLf & vbCrLf & _ "We would appreciate it if you could let us know when these goods have been delivered to you." & vbCrLf & vbCrLf & _ "Best regards," & vbCrLf & _ "Derek" & vbCrLf & vbCrLf & _ .Display End With End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.