7

I'm running into the rules size limit for Outlook 2003, so I want to merge/delete my rules. I want to be able to see them all as opposed to editing them one at a time. The export format for Outlook rules is some binary "*.rwz" file.

Is there a way to export Outlook rules into a text or excel file?

warren
  • 10,322
glenn jackman
  • 27,524

4 Answers4

2

The library https://github.com/hughbe/OutlookRulesReader contains a specification and reference implementation library (in Swift) for reading and writing Outlook Rules files in RWZ format.

A full description of the RWZ format can be found here.

H Bellamy
  • 121
1

Free https://rwzreader.codeplex.com/ - Organize rules by highlighting one or more rules and dragging to reorder, or use Up/Down buttons - Sort rules by highlighting two or more rules and clicking the sort button - Save the organized RWZ file as a different file or save the rules directly to Outlook

1

I modified some code I found and have this macro to list out all Rules in tab-delimited format suitable for a spreadsheet. Not elegant, perhaps, but it seems to work. I also have another borrowed macro for finding out which rules apply to a given selected folder.

    Sub ListRules() ' Created: 20200726
        'https://superuser.com/a/1571875/1007423
        'Modified by www.jfkelley.com
        'I impose no copyright conditions on the parts of this macro that I wrote.  Enjoy.
        'Based on: http://www.slipstick.com/outlook/rules/create-list-rules/
        'This will cull out all the Outlook Rules you have and print them out to a TXT file in your Temp directory.
        'It will also OPEN that TXT file using default editor (e.g., Notepad/Notepad++)
        'The data is tab-delimited so you can copy/paste it right into Excel.
        'It currently only features the 5 conditions of most interest to me,
        'but it should also enumerate any other conditions that are used in case you want to add those columns explicitly.
    Dim colStores As Outlook.Stores
    Dim oFileSys As Object
    Dim oStore As Outlook.Store
    Dim oRoot As Outlook.Folder
    Dim oCondition As Outlook.RuleCondition
    Dim oCondfrom As Outlook.RuleCondition
    Dim oAction As Outlook.RuleAction
    Dim colRules As Object
    Dim oRule As Outlook.Rule
    Dim oInbox As Outlook.Folder
    Dim oMoveTarget As Outlook.Folder
    Dim sOutput As String
    Dim myVar As Variant

    Dim dR As Object
    Set dR = CreateObject("Scripting.Dictionary")
    dR.Add olConditionAccount, "olConditionAccount"
    dR.Add olConditionAnyCategory, "olConditionAnyCategory"
    dR.Add olConditionBody, "olConditionBody"
    dR.Add olConditionBodyOrSubject, "olConditionBodyOrSubject"
    dR.Add olConditionCategory, "olConditionCategory"
    dR.Add olConditionCc, "olConditionCc"
    dR.Add olConditionDateRange, "olConditionDateRange"
    dR.Add olConditionFlaggedForAction, "olConditionFlaggedForAction"
    dR.Add olConditionFormName, "olConditionFormName"
    dR.Add olConditionFrom, "olConditionFrom"
    dR.Add olConditionFromAnyRssFeed, "olConditionFromAnyRssFeed"
    dR.Add olConditionFromRssFeed, "olConditionFromRssFeed"
    dR.Add olConditionHasAttachment, "olConditionHasAttachment"
    dR.Add olConditionImportance, "olConditionImportance"
    dR.Add olConditionLocalMachineOnly, "olConditionLocalMachineOnly"
    dR.Add olConditionMeetingInviteOrUpdate, "olConditionMeetingInviteOrUpdate"
    dR.Add olConditionMessageHeader, "olConditionMessageHeader"
    dR.Add olConditionNotTo, "olConditionNotTo"
    dR.Add olConditionOnlyToMe, "olConditionOnlyToMe"
    dR.Add olConditionOOF, "olConditionOOF"
    dR.Add olConditionOtherMachine, "olConditionOtherMachine"
    dR.Add olConditionProperty, "olConditionProperty"
    dR.Add olConditionRecipientAddress, "olConditionRecipientAddress"
    dR.Add olConditionSenderAddress, "olConditionSenderAddress"
    dR.Add olConditionSenderInAddressBook, "olConditionSenderInAddressBook"
    dR.Add olConditionSensitivity, "olConditionSensitivity"
    dR.Add olConditionSentTo, "olConditionSentTo"
    dR.Add olConditionSizeRange, "olConditionSizeRange"
    dR.Add olConditionSubject, "olConditionSubject"
    dR.Add olConditionTo, "olConditionTo"
    dR.Add olConditionToOrCc, "olConditionToOrCc"
    dR.Add olConditionUnknown, "olConditionUnknown"


    'On Error Resume Next
    Set oFileSys = CreateObject("Scripting.FileSystemObject")

    'Create a folder named Rules on your C drive or change the path to use an existing folder
    Dim fnp As String
    fnp = Environ("temp") & "\OLFilterList.txt"
    If oFileSys.FileExists(fnp) Then
        oFileSys.DeleteFile (fnp)
    End If
    Open fnp For Output As #1

    Set colStores = Application.Session.Stores
    Set oStore = colStores(1)
    Set oRoot = oStore.GetRootFolder
    Set colRules = oStore.GetRules
    Dim stHdr As String, stName As String, stToFolder As String, stFrom As String, stSenderAddress As String, stSentTo As String, stRecipientAddress As String, stOthers As String

    stHdr = "Order" & Chr(9) & "Name" & Chr(9) & "ToFolder" & Chr(9) & "From" & Chr(9) & "SenderAddress" & Chr(9) & "SentTo" & Chr(9) & "RecipientAddress" & Chr(9) & "OtherConditions"
    Print #1, stHdr


    For Each oRule In colRules
        stName = oRule.Name
        stToFolder = "??"
        stFrom = ""
        stSenderAddress = ""
        stSentTo = ""
        stRecipientAddress = ""
        stOthers = ""


        For Each oAction In oRule.Actions
            If oAction.Enabled = True Then
                If oAction.ActionType = olRuleActionMoveToFolder Then
                    stToFolder = oAction.Folder.FolderPath
                End If

                'add more actions here

            End If
        Next

        For Each oCondition In oRule.Conditions
            If oCondition.Enabled = True Then
                If oCondition.ConditionType = olConditionFrom Then
                    stFrom = oRule.Conditions.From.Recipients(1)
                ElseIf oCondition.ConditionType = olConditionSenderAddress Then
                    For Each myVar In oRule.Conditions.SenderAddress.Address
                        If stSenderAddress <> "" Then stSenderAddress = stSenderAddress & "; "
                        stSenderAddress = stSenderAddress & myVar
                    Next
                ElseIf oCondition.ConditionType = olConditionSentTo Then
                    For Each myVar In oRule.Conditions.SentTo.Recipients
                        If stSentTo <> "" Then stSentTo = stSentTo & "; "
                        stSentTo = stSentTo & myVar
                    Next
                ElseIf oCondition.ConditionType = olConditionRecipientAddress Then
                    For Each myVar In oRule.Conditions.RecipientAddress.Address
                        If stRecipientAddress <> "" Then stRecipientAddress = stRecipientAddress & "; "
                        stRecipientAddress = stRecipientAddress & myVar
                    Next
                Else
                    If stOthers <> "" Then stOthers = stOthers & "; "
                    stOthers = stOthers & dR(oCondition.ConditionType)
                End If

                'add more ElseIf conditions above and follow the pattern for the header (above) and data (below).

            End If
        Next
        stOutput = (oRule.ExecutionOrder) & Chr(9) & stName & Chr(9) & stToFolder & Chr(9) & stFrom & Chr(9) & stSenderAddress & Chr(9) & stSentTo & Chr(9) & stRecipientAddress & Chr(9) & stOthers
        Print #1, stOutput
    Next
    Close #1
    Dim fso As Object
    Set fso = CreateObject("shell.application")
    sfile = fnp
    fso.Open (sfile)
End Sub




Sub EnumerateRelatedRules() ' Created 20200726
    'Source: https://techniclee.wordpress.com/2011/06/18/finding-rules-related-to-a-folder-in-outlook/
    'The author also had some code to make this a context-menu (right-click) item, but I couldn't make it work.
    'So: Just select a folder (or email in a folder) and use Developer tab -> Macros to run it.
    'Works nicely in conjunction with my other spreadsheet report on all the Outlook Rules.
    '  - Posted here: https://superuser.com/questions/92197/export-outlook-2003-rules-to-text/1571875#1571875
    Dim olkRul As Outlook.Rule, olkAct As Outlook.RuleAction, strRules As String
    For Each olkRul In Application.Session.DefaultStore.GetRules()
        For Each olkAct In olkRul.Actions
            If olkAct.ActionType = olRuleActionCopyToFolder Or olkAct.ActionType = olRuleActionMoveToFolder Then
                If olkAct.Enabled Then
                    If olkAct.Folder = Application.ActiveExplorer.CurrentFolder Then  'olkCurrentFolder Then
                        strRules = strRules & olkRul.Name & vbCrLf
                    End If
                End If
            End If
        Next
    Next
    If strRules = "" Then
        strRules = "None"
    End If
    MsgBox strRules, vbInformation + vbOKOnly, "Rules Related to this Folder"
    Set olkRul = Nothing
    Set olkAct = Nothing
End Sub

1

I suspect that you are out of luck... a classic MS proprietary format.

However, a subset of the rules wizard interface is supported via VBA - see http://msdn.microsoft.com/en-us/library/bb206763.aspx for details. You could script something up to export the rules as human-readable but it may well not cover all your rules.

Good luck!