Thread: [Solved] Outlook VBA Question
View Single Post
 
Old 05-14-2015, 01:38 AM
garylombard garylombard is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: May 2015
Posts: 2
garylombard is on a distinguished road
Question Outlook VBA Question

Thank you for your reply GMayor

This is the code I am currently using in order to direct the mails coming in.

Code:
If TypeName(Item) = "MailItem" Then
    Dim strSender As String
    Dim myForward As MailItem
    
        strSender = Item.SenderEmailAddress
        If InStr(1, strSender, "xxxNamexxx", vbTextCompare) > 0 Or InStr(1, strSender, "xxx.com", vbTextCompare) > 0 Or InStr(1, strSender, "Me", vbTextCompare) > 0 Or InStr(1, strSender, "xxx.xx", vbTextCompare) > 0 Then
                If TypeName(Item) = "MailItem" Then
                                                                   
                ' Forward the item just received
                Set myForward = Item.Forward
           
                ' Address the message
                myForward.Recipients.Add "xx@example.com"
                myForward.Recipients.Add "xx@example.com"
                
                myForward.Send
            End If
        End If
    'End If

Kindly advise if you are able to assist in this matter

All help is much appreciated

Regards
Gary

Quote:
Originally Posted by gmayor View Post
Do we take it that you already have a macro that processes messages automatically? If so can you post that macro code?

If not the following line doesn't make sense as it stands.



What exactly is your process?

If you want to search for a date in the message body, the macro will need to know where to look, or it will be a laborious process to examine every bit of the message to see if it is a date, and then evaluate that date.
Reply With Quote