I made a Stupid mistake, can I recover from it?

dcharland

New Member
Joined
Mar 2, 2011
Messages
40
When i designed the logic of my code I made the mistake of not adding the email address from the sender before hand! So as an after thought I have put the email address from the sender, and would like to included in the "else", but run the code from the if (so going back)!!!

Here is the code anybody know how to do that?

HTML:
[QUOTE]the code above declares the variable "sender" and contains the email address from the sender.[/QUOTE]

     If InStr(MItem.body, "@") Then ' If MItem.body contains an @ character
        'Assign each word in the body of the email to Ewords
        MItem.unread = "False"
        Ewords = Split(MItem.body) ' Split each word in MItem.body and assign it to the Ewords variable
        
            For i = LBound(Ewords) To UBound(Ewords) ' sets the for i loop to the number of split in MItem
                If InStr(Ewords(i), "@") Then 'Found the string that contains an email address
                    'clean the email address
                    Call EmailAddresCleanup(Ewords(i))
[QUOTE]This is where I would like to "else" from below to start from, not going through the else again of course.[/QUOTE]
                    ReDim Preserve temparray(2, mea)
                    'look into my array to see if the email is already there?
              
                    If temparray(LBound(temparray), LBound(temparray)) <> "" Then 'compare emails
                        For j = LBound(temparray, 2) To UBound(temparray, 2)
                            If temparray(1, j) = emailclean Then temparray(2, j) = Status: t = "true" 'update its status only
                        Next j
                     
                     End If
                        If t <> "true" Then ' No match was found so writing the new email and status
                        temparray(1, mea) = emailclean
                        temparray(2, mea) = Status
                        mea = mea + 1
                        
                     Else
                        t = ""
                        End If
                   
                Else
                ' No emails were found in the string, look at next string
                End If
                
            Next i 'Next String in body of email
            
     'MsgBox MItem
     Else
    'MsgBox "No email in the body, need to find the code to grab it from the 'from'"

[QUOTE]Use the "sender" email and run it through the code above. [/QUOTE]
     
     End If
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,224,586
Messages
6,179,716
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top