+ Reply to Thread
Results 1 to 3 of 3

Can someone help me with following code to increase/faster outlook VBA Macro Speed ?

  1. #1
    Registered User
    Join Date
    12-05-2018
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    2

    Can someone help me with following code to increase/faster outlook VBA Macro Speed ?

    Hi

    Can someone help me with following code to increase/faster outlook VBA Macro Speed ? Currently It taking lot of time run all email rules and getting process slow.



    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

  2. #2
    Forum Expert
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2010 primarily
    Posts
    2,001

    Re: Can someone help me with following code to increase/faster outlook VBA Macro Speed ?

    Are you sure the delay isn't simply the rules themselves? How long do they take if you run them manually?
    Rory
    If a job's worth doing, it's worth doing right
    over your shoulder by your boss

  3. #3
    Forum Moderator
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux
    Posts
    6,379

    Re: Can someone help me with following code to increase/faster outlook VBA Macro Speed ?

    @nbm

    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1