![]() |
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
|
|||
|
|||
![]()
I need to call a COM component to process each incoming message. I can write
VBA to call it and get the response, but I can't find out how to invoke a VBA function from an Outlook rule. |
#2
|
|||
|
|||
![]()
A VBA procedure to be called by a "run a script" rule action needs 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 Dim rply as Outlook.MailItem strID = MyMail.EntryID Set olNS = Application.GetNamespace("MAPI") Set msg = olNS.GetItemFromID(strID) ' do stuff with msg, e.g. Set rply = msg.Reply rply.Body = "What you want the reply to say." rply.To = ; " rply.Send Set msg = Nothing Set rply = Nothing Set olNS = Nothing End Sub For more examples of "run a script" rule actions, see: http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 http://www.outlookcode.com/codedetail.aspx?id=1494 -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "rob" wrote in message ... I need to call a COM component to process each incoming message. I can write VBA to call it and get the response, but I can't find out how to invoke a VBA function from an Outlook rule. |
#3
|
|||
|
|||
![]()
Public Sub Foobar(item As MailItem)
' blah, blah End Sub Have your rule call Foobar from the "run a script" action in the rules wizard. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "rob" wrote in message ... I need to call a COM component to process each incoming message. I can write VBA to call it and get the response, but I can't find out how to invoke a VBA function from an Outlook rule. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
++++ Can I use macro to monitor incoming messages ? | Ian | Outlook and VBA | 5 | May 8th 07 03:54 AM |
Call macro from userdefined Ribbon | Steffen Grellmann | Add-ins for Outlook | 5 | March 22nd 07 01:18 PM |
OH YES I THINK THEY DID CALL MR BUT I DID NOT TALK TO THEM MY MAMA SAI CALL HER BACK LATER CUZ SHE IS DOING SOMETHG RIGHT NOW WHY DID YOU CALL ME NO | THEIR IS ONLY ONE ME YES SIR | Outlook Express | 0 | February 25th 07 08:12 AM |
Call macro stored in Excel workbook from Outlook's macro | Gvaram | Outlook and VBA | 5 | October 4th 06 06:26 AM |
Macro to open, retrieve contents, print, and loop through process | Michelle Marie | Outlook and VBA | 2 | February 24th 06 09:39 AM |