• 03: Rule to Forward Emails w/ time restrictions (O

    Home » Forums » AskWoody support » Productivity software by function » MS Outlook and email programs » 03: Rule to Forward Emails w/ time restrictions (O

    Author
    Topic
    #452630

    I want to create a rule in Outlook 2003 that will forward email from a certain address with certain words in the subject or body between 6pm – 8:00am Monday through Friday (and all day on Saturday and Sundays) to an another email address. I know outlook’s built in rules can’t do this, but I read I could do this with VB. I need help with the code.

    Viewing 0 reply threads
    Author
    Replies
    • #1118096

      This article supplies some background: Description of programming with Outlook rules (MSKB 324568). You can ignore everything after the heading “Outlook COM Add-in Rules.”

      With respect to the day of week and time, it might be a bit easier to check the current day of week and time on the PC rather than checking the message’s sent/received time. Here’s a function you could use:

      Function isAfterHours() As Boolean
      ' Set these to the appropriate hour (24 hours clock)
      Const dblStartOfDay As Double = 8
      Const dblEndOfDay As Double = 18
      ' Check current day and time and return appropriate value
      If Weekday(Now, vbMonday) > 5 Then
      ' It's the weekend
      isAfterHours = True
      Else
      If DateDiff("s", DateAdd("s", dblStartOfDay * 3600, Date), Now) 0 Then
      ' It's late in the evening
      isAfterHours = True
      Else
      isAfterHours = False
      End If
      End If
      End Function

    Viewing 0 reply threads
    Reply To: 03: Rule to Forward Emails w/ time restrictions (O

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: