Consulting

Results 1 to 4 of 4

Thread: Move Email After a Few Seconds

  1. #1

    Move Email After a Few Seconds

    Hello,
    I am looking for a way to have rule like: After the message arrives move it to the 2011 folder, but for xx seconds before moving each email.

  2. #2
    VBAX Regular
    Joined
    Jul 2010
    Posts
    66
    Location
    What are the criteria that you would be using for this 'rule'? I don't think that Outlook has a delay function for the rules, so you would probably have to use vba code to do what you want. (which can be [and probably has been] done, with some work).

    Have you searched the web for something like this, or even searched here on this site?

    GComyn

  3. #3
    VBAX Regular
    Joined
    Feb 2011
    Posts
    75
    Location
    Hello,

    the cheapest timer I know, is a loop counting from, say 1 to one million, in the loop do an operation, like accumulating a number. Put that at the top of your mail fetcher. You may have to dawdle a bit with the UNTIL value.
    This technique used to work on the pre 1 GHz processors.

    A mite more elegant is the Wait method of the Application object. It's available in Excel, and I dare to predict, it's in Outlook as well.

    Have fun testing.
    Isabella
    [VBA]Const FROM = 1
    Const UNTIL = 1000000
    Const WHATEVER = 1
    Dim lngCt as Long
    Dim lngAddUp as Long
    lngAddUp = 0
    For lngCt = FROM to UNTIL
    lngAddUp = lngAddUp + WHATEVER
    Next lngFrom
    '.... the remainder of the mail fetcher is here[/VBA]

  4. #4
    VBAX Expert JP2112's Avatar
    Joined
    Oct 2008
    Location
    Astoria, NY
    Posts
    590
    Location
    I'm afraid Outlook has no Wait Method. Here are the methods I've found.

    Sleep API
    [vba]
    ' put this at the top of your module
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    ' use this command to pause
    Sleep (5000) ' Waits for 5 seconds
    [/vba]

    Timer Function (from VBA Help)
    [vba]Dim PauseTime, Start, Finish, TotalTime
    If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
    PauseTime = 5 ' Set duration.
    Start = Timer ' Set start time.
    Do While Timer < Start + PauseTime
    DoEvents ' Yield to other processes.
    Loop
    Finish = Timer ' Set end time.
    TotalTime = Finish - Start ' Calculate total time.
    MsgBox "Paused for " & TotalTime & " seconds"
    Else
    End
    End If[/vba]
    Regards,
    JP

    Read the FAQ
    Getting free help on the web
    My website
    Please use [vba][/vba] tags when posting code

Posting Permissions

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