Wednesday, September 24, 2014

Enabled Outlook Rules using VBS Script.
HOW to Enable Outlook Rules using VBS Script or Visual basic Script or VBA

I have some Outlook rules that forward email to my GMAIL  (see my old post Forward Email from Outlook to GMAIL) , In my environment I can not use Rules themselves to forward email, So I had to write a custom VBA to do it,

Well the rule works great...most of the time...For some reason Outlook disables the rules intermittently probably due to fact that it cant connect to network/net drop, There is probabpy a setting in OL to change this, however instead of relying on Outlook to keep the rule enabled I added this VBS as a periodic task,


  1. Create a VBS file :

Set outlook = CreateObject("Outlook.Application")
Set colRules = outlook.Session.defaultstore.getrules()

For Each rule In colRules
'If rule.Name = @SomeName if you like
rule.Enabled = True
 
Next

 colRules.Save


2. Create Win Task to run the following command:
wscript "C:\Work\Tools\EnableRules.vbs"

Run schedule every few min or so.

1 comment:

  1. HOW to Enable Outlook Rules using VBS Script or Visual basic Script or VBA

    ReplyDelete