Results 1 to 18 of 18

Thread: Rule/Script Fail

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    The rule is intended to run on the message as it arrives. It is not intended to process a folder, and the addition you made to test it will not work either. The test macro I posted processes a single selected message. If you want to process a folder full of messages then use the following macro to call the process for each message in the selected folder. It doesn't run from a rule!:

    Note that the macro employs a progress indicator. You can download that progress indicator userform (attached), extract from the zip and import it into your VBA editor. It will crash without the indicator present.

    Sub ProcessFolder()
    'An Outlook macro by Graham Mayor
    Dim olNS As Outlook.NameSpace
    Dim olMailFolder As Outlook.MAPIFolder
    Dim olItems As Outlook.Items
    Dim olMailItem As Outlook.MailItem
    Dim ofrm As New frmProgress
    Dim PortionDone As Double
    Dim i As Long
    
        On Error GoTo err_Handler
        Set olNS = GetNamespace("MAPI")
        Set olMailFolder = olNS.PickFolder
        Set olItems = olMailFolder.Items
        ofrm.Show vbModeless
        i = 0
        For Each olMailItem In olItems
            i = i + 1
            PortionDone = i / olItems.Count
            ofrm.lblProgress.Width = ofrm.fmeProgress.Width * PortionDone
            SaveAttachments olMailItem
            DoEvents
        Next olMailItem
    err_Handler:
        Unload ofrm
        Set ofrm = Nothing
        Set olNS = Nothing
        Set olMailFolder = Nothing
        Set olItems = Nothing
        Set olMailItem = Nothing
    lbl_Exit:
        Exit Sub
    End Sub
    Attached Files Attached Files
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

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