View Single Post
  #6  
Old March 5th 10, 05:48 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Create a macro in Outlook to run a rule

Sub RunRuleDeleteSpam()
Application.Session.DefaultStore.GetRules.Item("De lete Spam").Execute
End Sub


--
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


"DLGolfs" wrote in message
...
OK here is what I did, the rules name is Delete spam:
Sub RunRuleDeleteSpam()
Application.Session.DefaultStore.GetRules.Item "Delete Spam.Execute"
End Sub

When I try to run it I get a run time error, The operation failed. An
object cannot be found. There is a number too.
I have the rule set up as Delete spam

then I made some changes and here is the string:
Sub RunRuleDeleteSpam()
Application.Session.DefaultStore.GetRules.Item Delete Spam.Execute
End Sub

now I am getting a syntax error

I am trying, never did this in the past, please be patient


Ads