Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   How can I automatically save attachments from inside a rule? (http://www.outlookbanter.com/outlook-vba/15711-how-can-i-automatically-save.html)

bobhody May 24th 06 08:20 PM

How can I automatically save attachments from inside a rule?
 
I want to set up an Outlook rule that given a specific keyword in the subject
line, any attachments will be sent to a specific folder. The rule wizard
doesn't seem to provide this unless I use "run a script" or perform a "custom
action", neither of which seems to be available...

Sue Mosher [MVP-Outlook] May 24th 06 11:19 PM

How can I automatically save attachments from inside a rule?
 
A "run a script" rule action actually uses not an external script but a VBA procedure with a MailItem or MeetingItem as its parameter. That item is processed by the code:


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
MsgBox msg.SUbject

Set msg = Nothing
Set olNS = Nothing
End Sub

See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another example.


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"bobhody" wrote in message ...
I want to set up an Outlook rule that given a specific keyword in the subject
line, any attachments will be sent to a specific folder. The rule wizard
doesn't seem to provide this unless I use "run a script" or perform a "custom
action", neither of which seems to be available...



All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com