Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to run some Outlook rule, which will be run than user moves a message from Inbox to some folder.

share|improve this question

It seems I found an answer to my own question :) I have to define the following macro and do that I want in myOlItems_ItemAdd method

Public WithEvents myOlItems As Outlook.Items

Public Sub Application_Startup()

' Reference the items in the Inbox. Because myOlItems is declared
' "WithEvents" the ItemAdd event will fire below.
 Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
 Set ee = Outlook.Session.GetDefaultFolder(olFolderInbox).Folders("MyTestFolder")
 Set myOlItems = ee.Items
End Sub

Private Sub myOlItems_ItemAdd(ByVal Item As Object)

 Debug.Print (Item.Subject)
End Sub
share|improve this answer

Outlook provides a predefined list of events that can trigger a rule to fire. If you cannot find one that will do what you want younare probably out of luck. While I suspect you can write your own COM plugin for this it is not for the average person.

share|improve this answer
Thank for the answer. Could you point me to some COM plugin sample? – ilia May 21 '11 at 20:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .