Link to home
Create AccountLog in
Outlook

Outlook

--

Questions

--

Followers

Top Experts

Avatar of sshani
sshani๐Ÿ‡บ๐Ÿ‡ธ

Outlook 2010 - Run a rule based on schedule
Hello all.

I am using outlook 2010 and have made a rule for a specific purpose. I can easily turn this rule on and off manually.

What I am looking for is an automatic, unattended way to turn this rule on and off. I know I can use a VB script to turn the rule on and off and I can also use windows task scheduler to take care of the scheduling. But, I have not found a script (yet) that turns on/off a SPECIFIC rule - only scripts that turn on/off ALL rules (which is not what I need).

This rule would need to be turned on during off business hours (5pm - 8am) and all day during weekend days.

Anyone know how to do this?
Regards.

Please only respond if your solution answers my query exactly :)

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Khalid OmarKhalid Omar๐Ÿ‡ฏ๐Ÿ‡ด

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of sshanisshani๐Ÿ‡บ๐Ÿ‡ธ

ASKER

Almost what I need. I can use the date/time check in the script, but I don't really need anything moved. I really need emails forwarded. I already have a rule to forward incoming emails. Is there a way to change the script you included to simply run the other rule I have already created?

Avatar of Khalid OmarKhalid Omar๐Ÿ‡ฏ๐Ÿ‡ด

You can modify the script I attached to forward the message for you, for example you can use:
' This code is taken from here: http://support.microsoft.com/kb/292063
Set myForward = Item.Forward
myForward.Recipients.Add "myaddress@mydomain.com"
myForward.Send

Open in new window


If you you want to run an existing Outlook rule from the script, then you can modify the code as follows:
' This code is a modified version of the code in: http://www.outlookcode.com/codedetail.aspx?id=1266
'
' Get default store (where rules live)
Set st = Application.Session.DefaultStore

' Get rules
Set myRules = st.GetRules
     
' Find the required rule by its name
' The code below assumes the rule name is: Forward Me
For Each rl In myRules
        If rl.Name = "Forward Me" Then
            rl.Execute ShowProgress:=True
            Exit For
        End If
Next

Open in new window


Avatar of sshanisshani๐Ÿ‡บ๐Ÿ‡ธ

ASKER

I figured it out. I used a derivation of what you had posted. I would not have been able to do it without your listing - so you get full points. ย Thanks!

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Outlook

Outlook

--

Questions

--

Followers

Top Experts

Microsoft Outlook is a personal information manager from Microsoft, available as a part of the Microsoft Office suite. Although often used mainly as an email application, it also includes a calendar, task manager, contact manager, note-taker, journal, and web browser.