+ Reply to Thread
Results 1 to 6 of 6

Outlook vba macro to monitor new emails is not firing when new emails are received. Help?

  1. #1
    Registered User
    Join Date
    08-15-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2013
    Posts
    29

    Outlook vba macro to monitor new emails is not firing when new emails are received. Help?

    I'm very familiar with vba in Excel, but I'm almost completely new to using vba in Outlook. I'm trying to write a macro that will run whenever a new email is received. I want the macro the check if the subject line matches a certain condition and then, if it does, save the attachment to a specified folder. I'm getting hung up on the "run whenever an email is received" part. I found some code here:

    https://stackoverflow.com/questions/...ved-in-outlook

    and I replaced the "do something here" part with "Debug.Print Msg.Subject". I've sent myself several test emails from a different account to check that the code is working, but the subject line never prints in the Immediate window. I've double checked that the code is in ThisOutlookSession. I've also restarted Outlook. Neither have had any apparent effect.

    Can anyone help? What do I need to do differently in order to get my code to run whenever a new message is received?

    I've cross-posted this question here:
    https://www.reddit.com/r/vba/comment...henever_a_new/

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    19,615

    Re: Outlook vba macro to monitor new emails is not firing when new emails are received. He

    Any reason you want to write code to do that rather than using Outlook's built in rules?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    08-15-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Outlook vba macro to monitor new emails is not firing when new emails are received. He

    I actually didn't know Outlook had this functionality built-in! Any chance you could point me in the direction of where I would find this?

    That aside, even if the way you're suggesting is easier - I'm still a bit puzzled why the macro isn't working. I'll probably just use the simpler solution if there's something pre-built into Outlook, but it would be good to know for future reference what was wrong with the code.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    19,615

    Re: Outlook vba macro to monitor new emails is not firing when new emails are received. He

    https://support.microsoft.com/en-us/...7-a50704d66c59

    I have not looked at your code on the other sites

  5. #5
    Registered User
    Join Date
    08-15-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Outlook vba macro to monitor new emails is not firing when new emails are received. He

    Thanks! I appreciate the help.

  6. #6
    Registered User
    Join Date
    08-15-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2013
    Posts
    29

    Re: Outlook vba macro to monitor new emails is not firing when new emails are received. He

    Hmmm....after looking into this a bit more, I think the rules are limited in a way that means they won't be able to do what I need. Ultimately, I want to save attachments in a specified folder for all incoming emails that meet a certain criteria. It seems like the Outlook built-in rules don't allow for that?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to Draft Outlook Emails and Attach files in Emails
    By arun.sj in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-17-2020, 05:48 AM
  2. Replies: 0
    Last Post: 12-08-2019, 05:30 PM
  3. Track Outlook Emails - sent emails in Excel
    By baluraipur in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2015, 09:18 AM
  4. [SOLVED] Sending Outlook emails from Excel; Limits to three emails only?
    By BPSJACK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 06:53 AM
  5. Send outlook emails with message in cells to individual emails associated with them
    By abinayan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2011, 06:11 AM
  6. Sending macro emails using excel: Send emails with their passwords.
    By loveisblind in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2009, 03:16 PM
  7. Monitor Email - Not another sending emails
    By Killavirus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2009, 07:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1