Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2015, 11:59 AM
garylombard garylombard is offline Outlook VBA Question Windows 7 64bit Outlook VBA Question Office 2010 32bit
Novice
Outlook VBA Question
 
Join Date: May 2015
Posts: 2
garylombard is on a distinguished road
Question 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
Reply With Quote
  #2  
Old 05-05-2015, 11:06 PM
gmayor's Avatar
gmayor gmayor is offline Outlook VBA Question Windows 7 64bit Outlook VBA Question Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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:
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?
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.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 05-14-2015, 01:38 AM
garylombard garylombard is offline Outlook VBA Question Windows 7 64bit Outlook VBA Question Office 2010 32bit
Novice
Outlook VBA Question
 
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
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook VBA Question 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft