Answered by:
Script to Extract a pdf Attachment out of Outlook

Question
-
I have Microsoft Outlook 2007. I was wondering if I can set a rule up in Outlook to take any e-mail with my companies Change Order Form (a pdf file - usually, when this file comes up, it has the words "Change Order" in the subject line of the e-mail) and save the attachment to a place on my harddrive. Is this possible? I saw where a rule can be set up to "run script" when certain crieria apply. Is this something that could be done through java script? If so, how should the java script read? Any assistance you can provide would be greatly appreciated.
- Moved by Bill_Stewart Tuesday, March 27, 2012 3:13 PM Move to more appropriate forum (From:The Official Scripting Guys Forum!)
Tuesday, March 27, 2012 2:37 PM
Answers
-
No problem.
MSDN is your friend:
Attachment.SaveAsFile Method (Outlook):
http://msdn.microsoft.com/en-us/library/ff869359.aspxThere's lots of code at OutlookCode.com as well.
Eric Legault
MVP (Outlook)
About me...- Marked as answer by AuntDi Tuesday, March 27, 2012 8:37 PM
Tuesday, March 27, 2012 6:32 PM
All replies
-
The existing Rules Wizard can't save attachments, so you'll have to create a rule to run a script:
How to create a script for the Rules Wizard in Outlook:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q306108The "script" is actually a VBA macro within Outook, so you can't use JavaScript.
Eric Legault
MVP (Outlook)
About me...Tuesday, March 27, 2012 3:39 PM -
Thank you for the information. Do you by chance know where I can find vba that will save the attachments in a separate file?Tuesday, March 27, 2012 6:05 PM
-
No problem.
MSDN is your friend:
Attachment.SaveAsFile Method (Outlook):
http://msdn.microsoft.com/en-us/library/ff869359.aspxThere's lots of code at OutlookCode.com as well.
Eric Legault
MVP (Outlook)
About me...- Marked as answer by AuntDi Tuesday, March 27, 2012 8:37 PM
Tuesday, March 27, 2012 6:32 PM -
Look on this:
Tworzenie własnego programu - Lekcja 3. Export załączników z parametrami (pl-PL)
Saving images and attachments used in e-mail messages (en-US)
Oskar Shon, Office System MVP
Press
if Helpful; Answer when a problem solved
Tuesday, March 27, 2012 8:32 PM -
The code on OutlookCode.com worked perfectly. Thank you so much for your help.Tuesday, March 27, 2012 8:36 PM
-
I have a question regarding the code that I added to Outlook yesterday. Everything ran perfectly yesterday. However, when I try to run the same Macro today, I keep getting an error message. The message says "The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros." When I click on the help button, it just tells me that I need to open the program with macros enabled, but I don't have that option when I open Outlook. This worked yesterday, why won't it work today. I didn't do anything differently. How can I turn the macros on and have them come on each time I open Outlook?Wednesday, March 28, 2012 12:53 PM
-
You need to change the macro settings in Outlook, not at startup. Go to Options -> Trust Center -> Macro Settings. You want to set it to "Enable all" or "Notifications for all macros".
Eric Legault
MVP (Outlook)
About me...Wednesday, March 28, 2012 4:58 PM -
That worked. Thank you.Wednesday, March 28, 2012 5:02 PM