none
Rule problems RRS feed

  • Question

  • Good afternoon!

    There is a rule in outlook, it applies when the Email comes from definite address and runs VBA script. There are cases, when this rule doesn’t work correctly. The problem appears then I send some Email simultaneously.

     

    Example:

    I send three Email with subjects FW: 1, FW: 2, FW: 3

    In Inbox I see them in order FW: 1, FW: 2, FW: 3

    But my script gives:

    20.01.2012 15:13:29:0974 ***** Process ***** 20.01.2012 15:13:21 Subject FW: 3

    20.01.2012 15:13:29:0988 ***** Process ***** 20.01.2012 15:13:18 Subject FW: 2

    20.01.2012 15:13:30:0004 ***** Process ***** 20.01.2012 15:13:15 Subject FW: 1

    It reverses order Email to FW: 3, FW: 2 FW: 1

     

    Sqript:

     

    Option Explicit
    
    Private Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
    End Type
    
    Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
    
    Sub CustomMailMessage_111111111111(Item As Outlook.MailItem)
        
        Dim Path As String
        Path = "C:\Post_CB"
        
        Dim fso As Variant
        Set fso = CreateObject("Scripting.FileSystemObject")
        
        Dim idFile_Llog As Variant
        Set idFile_Llog = fso.OpenTextFile(Path & "\log_in.log", 8, True)
        
        Dim tSystem As SYSTEMTIME
        GetSystemTime tSystem
        
        idFile_Llog.writeline (CStr(Now()) & ":" & Format(tSystem.wMilliseconds, "0000") & " ***** Process ***** " & CStr(Item.ReceivedTime) & " Subject " & CStr(Item.Subject))
        idFile_Llog.Close
        Set fso = Nothing
    
    End Sub
    

     

     

    How can I get another order:

    20.01.2012 15:13:29:0974 ***** Process ***** 20.01.2012 15:13:21 Subject FW: 1

    20.01.2012 15:13:29:0988 ***** Process ***** 20.01.2012 15:13:18 Subject FW: 2

    20.01.2012 15:13:30:0004 ***** Process ***** 20.01.2012 15:13:15 Subject FW: 3


    • Edited by lgnFox Monday, January 23, 2012 5:19 AM
    • Moved by Max Meng Wednesday, January 25, 2012 7:28 AM Moving to a more appropriate forum (From:Outlook IT Pro Discussions)
    Friday, January 20, 2012 11:47 AM

Answers

  • The order in which events will fire for unrelated messages is undetermined. You should never rely on any particular order.

    In most cases, Outlook will try ot download the most recent (and hence most important to most users) messages first.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Wednesday, January 25, 2012 4:37 PM