#  Other Applications & Softwares  > Outlook Formatting & Functions >  >  How to Schedule Outlook Macro to run daily at specific time

## spriyatam

Hi,

There are some specific email addresses from which I get emails everyday at specific times. These emails have some excel file attachments which I need to use for some reports. I have a VBA macro saved in my Outlook 2013 which I need to manually run on daily basis to automatically download and move those files to specific folders on my hard drive. Now, I am in process to fully automate my entire report for which I need my Outlook macro to run on a defined time. The next steps to use those excel files are already automated.

I tried to do it through Windows scheduler (OS - Windows7) but it seems it doesn't work that way.

Can someone please help me on this - It would be really great.

Best Regards,
Shaurya

----------


## skatonni

You can tweak this http://www.vboffice.net/sample.html?...0&cmd=showitem to call the report code.

You should be able to set recurrence in the task rather than creating a new daily task in the code.

Further reading. You can initialize in Application_Startup in ThisOutlookSession. http://msdn.microsoft.com/en-us/libr...ffice.15).aspx

----------


## spriyatam

Hi Skatonni,

Thank you for looking and replying to this thread. I am afraid to say that it didn't helped me as the code mentioned on that URL is to schedule an auto email. However, my issue is with regards to saving attachments from the emails at specific time on daily basis where my Outlook application remains opened on the PC always.

Kindly suggest.

----------


## skatonni

The link was to give you the idea of using a task to schedule your report.

Let us say your code is MyReport. Set up a recurring task with subject "Run my report", with a reminder.

The reminder event calls your code. (I note that I threw in "further reading" that did not apply.)

In This OutlookSession module.




```
Please Login or Register  to view this content.
```


In a normal module.




```
Please Login or Register  to view this content.
```

----------


## spriyatam

Hi Skatonni,

Firstly, Thank you once again for your kind reply. Let me provide you a brief details as what I have done so far:
My Macro code in Outlook are saved within 'ThisOutlookSession' only. Then I have activated an outlook rule also. All I want is to do that when an email I receive from specific mail sender, it would first move those emails under the desired folder. And then it should run my Macro. This code is working successfully by running manually. But it's not working through the outlook rule automatically. Hope I have explained my concern thoroughly. 

Below is the complete code details which I am using in the outlook macro for your purusal.




```
Please Login or Register  to view this content.
```


Kindly Help.

----------


## spriyatam

Please let me know your thoughts about it.

----------


## skatonni

The thread question is "How to Schedule Outlook Macro to run daily at specific time". You have my answer but the code must be in a format that can run manually. It seems this question is premature.

******************************************************

You can run RunAScriptRuleRoutine through a rule. RunAScriptRuleRoutine does nothing.

You can run LPWirelineExtract_Data manually. LPWirelineExtract_Data does nothing.

Application_ItemSend runs when you send. Your Application_ItemSend does nothing.





> ... All I want is to do that *when an email I receive from specific mail sender, it would first move those emails under the desired folder.* And then it should run my Macro. This code is working successfully by running manually. But it's not working through the outlook rule automatically...



Mail can be moved to Outlook folders by rule conditions without VBA.






> ... All I want is to do that when an email I receive from specific mail sender, it would first move those emails under the desired folder. *And then it should run my Macro.* This code is working successfully by running manually. *But it's not working through the outlook rule automatically*...



SaveEmailAttachmentsToFolder requires parameters to be passed to it. I cannot see how any code could be "working successfully by running manually".

I believe the question for your new thread could be "How to pass parameters to code that saves attachments". Include the code for SaveEmailAttachmentsToFolder.

----------


## jme851

Skatonni, thank you for this post - wanted you to know it still works great!!! (using Outlook 365)    :Smilie:

----------

