Run A SCRIPT - Select Script EMPTY

M

mitupan116

Hello ALL,

I need to download attachements from incoming mails and have a Macr
script to do the job. The macro seems to be working fin
independently.

I am able to execute it from TOOLS--Macro from (Outlook 2003) but I a
not able to automate the macro to be run from a RULE.

When I create rule and try to select the macro..the select script come
as EMPTY. How do I attach the macro to the RULE and make it appear unde
the SCRIPTS.

I have set macro security settings to LOW. Please hel
 
S

Sue Mosher [MVP-Outlook]

A "run a script" rule action requires not a macro, which has no arguments, 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.Body

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

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Top