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
|
|||
|
|||
Macro to Run Rules
How can I run only specific rules in 2007?
|
Ads |
#2
|
|||
|
|||
Macro to Run Rules
The code sample at http://www.outlookcode.com/codedetail.aspx?id=1266 shows
how to run all rules against the Inbox. If you want to run only certain rules, return each rule using myRules.Item("name of rule") and then call its Execute method. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Kash" wrote in message ... How can I run only specific rules in 2007? |
#3
|
|||
|
|||
Macro to Run Rules
I'm able to run only one macro.. 'Clear categories'
|
#4
|
|||
|
|||
Macro to Run Rules
Code?
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Kash" wrote in message ... I'm able to run only one macro.. 'Clear categories' |
#5
|
|||
|
|||
Macro to Run Rules
Sub RunAllInboxRules()
Dim st As Outlook.Store Dim myRules As Outlook.Rules Dim rl As Outlook.Rule Dim count As Integer Dim ruleList As String 'On Error Resume Next ' get default store (where rules live) Set st = Application.Session.DefaultStore ' get rules Set myRules = st.GetRules ' iterate all the rules For Each rl In myRules ' determine if it's an Inbox rule If rl.RuleType = olRuleReceive Then ' if so, run it rl.Execute ShowProgress:=True count = count + 1 ruleList = ruleList & vbCrLf & rl.Name End If Next ' tell the user what you did ruleList = "These rules were executed against the Inbox: " & vbCrLf & ruleList MsgBox ruleList, vbInformation, "Macro: RunAllInboxRules" Set rl = Nothing Set st = Nothing Set myRules = Nothing End Sub |
#6
|
|||
|
|||
Macro to Run Rules
If you step through the code in the debugger, what happens inside the For
Each loop? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Kash" wrote in message ... Sub RunAllInboxRules() Dim st As Outlook.Store Dim myRules As Outlook.Rules Dim rl As Outlook.Rule Dim count As Integer Dim ruleList As String 'On Error Resume Next ' get default store (where rules live) Set st = Application.Session.DefaultStore ' get rules Set myRules = st.GetRules ' iterate all the rules For Each rl In myRules ' determine if it's an Inbox rule If rl.RuleType = olRuleReceive Then ' if so, run it rl.Execute ShowProgress:=True count = count + 1 ruleList = ruleList & vbCrLf & rl.Name End If Next ' tell the user what you did ruleList = "These rules were executed against the Inbox: " & vbCrLf & ruleList MsgBox ruleList, vbInformation, "Macro: RunAllInboxRules" Set rl = Nothing Set st = Nothing Set myRules = Nothing End Sub "Kash" wrote in message ... I'm able to run only one macro.. 'Clear categories' "Sue Mosher [MVP]" wrote in message ... The code sample at http://www.outlookcode.com/codedetail.aspx?id=1266 shows how to run all rules against the Inbox. If you want to run only certain rules, return each rule using myRules.Item("name of rule") and then call its Execute method. "Kash" wrote in message ... How can I run only specific rules in 2007? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Run Rules | ausfilminstitute | Outlook and VBA | 3 | March 17th 10 12:26 PM |
Macro to Write Rules | Stratuser | Outlook and VBA | 4 | June 23rd 09 10:40 PM |
rules to run macro | DSPettit | Outlook - General Queries | 3 | April 27th 07 04:06 PM |
Macro to run Rules in batch | bman342 | Outlook and VBA | 4 | March 14th 07 06:16 PM |
Rules an macro | Gerd Neumann | Outlook and VBA | 4 | May 17th 06 09:48 PM |