Avatar of Afzal Khan
Afzal KhanFlag for United States of America

asked on 

Need help to trigger outlook macro automatically when new email comes in Specific folder

Hi Experts ,

I have a  Independent folder in Outlook named "Test" .
I have macro whose work is to get the attachment from "Test" folder emails and save at"EmailAttachments" folder in "MyDocuments"

So the program is working when I manually run the macro , So I need your help to set some program which can run this macro automatically .
The program should run when new email comes in "Test" folder only otherwise if it will check inbox and all outlook then it will be performance issue.

I am using below code in "ThisOutlookSession" but it is checking all incoming emails in outlook , just need to check "Test" folder only.

Private Sub Application_NewMail()
    Call SaveAttachments
End Sub 

Open in new window



Also "Run as Script" is not available.


Appreciate any help in this regard.
VB ScriptOutlookVBA

Avatar of undefined
Last Comment
Afzal Khan
Avatar of Shimshey Rosenberg
Shimshey Rosenberg
Flag of United States of America image

How are the emails getting into the test folder? Is it with a rule?
You can utilize the same rule to run a script.

See this link;
https://www.slipstick.com/outlook/rules/outlook-2016-run-a-script-rules/
Avatar of Afzal Khan
Afzal Khan
Flag of United States of America image

ASKER

Shimshey the emails are coming through Outlook rule , Unfortunately "Run as Script" is not available in outlook due to security reasons.
What are you looking help with? running it only on a specific folder? or running it automatically?
Avatar of Afzal Khan
Afzal Khan
Flag of United States of America image

ASKER

I need help to run the macro automatically when new email comes only to that folder"Test" , As of now I am manually running it.
ASKER CERTIFIED SOLUTION
Avatar of Afzal Khan
Afzal Khan
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Outlook
Outlook

Microsoft Outlook is a personal information manager from Microsoft, available as a part of the Microsoft Office suite. Although often used mainly as an email application, it also includes a calendar, task manager, contact manager, note-taker, journal, and web browser.

105K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo