To get you going a little routine that shows you how to extract the amount on which you decide where to put the email. First you select a mail and this routine will check the selected mail and show you the number and if it's <= 100.
CharlizeSub Amount_Order() Dim mymessage As Outlook.MailItem 'the text of the message Dim thebody As String 'mynumber is the amount of the order. Defined as double because 'we want to process the stuff after the decimal too Dim mynumber As Double 'we are going to process the selected mailitem 'make sure it's a mailitem and nothing else (ie. read receipt or something else) Set mymessage = ActiveExplorer.Selection.Item(1) 'store the messagebody to the variable thebody = mymessage.Body 'display it MsgBox thebody 'locate the start of the number in the message body and add 9 because 'we don't need the search string (TOTAL AMT) included 'then locate the end of the number you want. in this case I used VENDOR because 'that's the first word after the number you are after 'starting from the searchstring TOTAL AMT and we are going to 'substract 9 + the number where we found VENDOR (1st occurence after starting point 'from TOTAL AMT to determine the number ' 'check if email has TOTAL AMT phrase If InStr(1, thebody, "TOTAL AMT") <> 0 Then mynumber = Mid(thebody, InStr(1, thebody, "TOTAL AMT") + 9, _ InStr(InStr(1, thebody, "TOTAL AMT"), thebody, "VENDOR") - _ InStr(1, thebody, "TOTAL AMT") - 9) If mynumber < 101 Then MsgBox mynumber & " <= 100" Else MsgBox mynumber & " > 100" End If Else MsgBox "No mail with TOTAL AMT number." End If End Sub




Reply With Quote