If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
rules to run macro
Hello all,
Is there a way to cause a rule to run a macro? I have a macro written that runs fine if invoked manually, but I don't seem to be able to find a way to cause a rule to run a macro. Thanks, Doug |
Ads |
#2
|
|||
|
|||
rules to run macro
A "run a script" rule action actually can run 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 -- 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 "DSPettit" wrote in message ... Hello all, Is there a way to cause a rule to run a macro? I have a macro written that runs fine if invoked manually, but I don't seem to be able to find a way to cause a rule to run a macro. Thanks, Doug |
#3
|
|||
|
|||
rules to run macro
Sue,
Thanks for the help. I see what you are saying. Unfortunately, I am running Outlook 2000 SP-3, and "run a script" is not available. I am guessing that my best option is to upgrade to something more current. Any other thoughts or ideas? Thanks, Doug "Sue Mosher [MVP-Outlook]" wrote in message ... A "run a script" rule action actually can run 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 -- 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 "DSPettit" wrote in message ... Hello all, Is there a way to cause a rule to run a macro? I have a macro written that runs fine if invoked manually, but I don't seem to be able to find a way to cause a rule to run a macro. Thanks, Doug |
#4
|
|||
|
|||
rules to run macro
Either that or use the ItemsAdd different approach; see http://www.outlookcode.com/d/code/zaphtml.htm
Now you know that you really need to include your Outlook version whenever you post here. -- 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 "DSPettit" wrote in message ... Sue, Thanks for the help. I see what you are saying. Unfortunately, I am running Outlook 2000 SP-3, and "run a script" is not available. I am guessing that my best option is to upgrade to something more current. Any other thoughts or ideas? Thanks, Doug "Sue Mosher [MVP-Outlook]" wrote in message ... A "run a script" rule action actually can run 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 -- 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 "DSPettit" wrote in message ... Hello all, Is there a way to cause a rule to run a macro? I have a macro written that runs fine if invoked manually, but I don't seem to be able to find a way to cause a rule to run a macro. Thanks, Doug |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to run Rules in batch | bman342 | Outlook and VBA | 4 | March 14th 07 06:16 PM |
Rules for moving outside mails to specific folder (Macro) | Moshico | Outlook and VBA | 1 | January 22nd 07 02:03 PM |
OL2003: Need macro to run all rules | [email protected] | Outlook - General Queries | 3 | September 4th 06 03:54 AM |
Rules an macro | Gerd Neumann | Outlook and VBA | 4 | May 17th 06 09:48 PM |
Execute rules with a macro | Gerd Neumann | Outlook and VBA | 1 | May 11th 06 09:50 PM |