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/