#1
|
|||
|
|||
Outlook VBA Question
Hello all,
Gary here, I know nothing about VBA and hence my question to all you guru's Is there a way, as soon as an email comes in and its body contains a date earlier than today's date for a macro already in it VBE, to not send out that mail? I am sitting with a problem where previous mails are being drawn back into Outlook, previously archived. The macro, already resident in the background, sniffs out the mail with the appropriate signature in its body as soon as it comes in and send it off to the relevant parties. But due to it being drawn back in it automatically sends them out again. I know I could just simply disable the macro, but then all new valid mails will be ignored and clients wont receive this valuable information Please advise as this is causing major frustrations at my clients and also in my mailbox. Thank you very much in advance for your help Outlook 2010 Regards Gary |
#2
|
||||
|
||||
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. Quote:
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.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
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:
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2010 .pst question | smann | Outlook | 1 | 10-04-2012 07:01 PM |
Outlook chart question | projecttoday | Outlook | 0 | 11-11-2011 11:29 AM |
Loading Outlook sent emails question | jeff8362 | Outlook | 2 | 04-23-2011 08:15 PM |
Outlook express question!!!! | wascapsfan | Outlook | 0 | 02-07-2011 12:35 PM |
Outlook Anywhere question.... | Grima Wormtonue | Outlook | 0 | 02-20-2009 09:27 AM |