I have Outlook 2016 on my computer at work and the "Run a Script" rule has been disabled. I'm aware of the changes that should be made in the regedit
file, but I need admin access to do so. My IT team is located across the country from me, so I've been waiting for two weeks for them to change this and I'm convinced that it's never going to happen.
So, I'm wondering if there's a workaround or a way to code the same process?
When I receive an e-mail with certain words in the subject line, I would like the rule/script to save the file attachment (inside the e-mail) into a folder on my computer.
I'm no VBA expert at all (especially with Outlook), so I'm probably far away from being on the right path, but I've given it a shot:
Private Sub Application_Startup()
Dim oRule as Outlook.Rule
Dim oRuleAction as Outlook.RuleAction
Dim oRuleCondition as Outlook.RuleCondition
Set oRule = colRules.Create("Transfer Attachment", olRuleSubject)
Set oRuleCondition = oRule.Conditions.Subject("FINAL-CPW GRP SALES")
Set oRuleAction = SaveAtlasReport
End Sub
Public Sub SaveAtlasReport()
Dim att as Attachment
Dim FileName as string
FileName = "C:\Users\WCD1867\Documents\AttachTest\PositivePOS.xlsx"
att.SaveAsFile FileName
End Sub
By definition you can't run a script when running scripts are disabled. If you could then hackers around the globe would rejoice and people would have to stop using Outlook for corporate mail.
There is no built-in function to do what you want.
It can be done with plugins, like Kutools: https://www.extendoffice.com/product/kutools-for-outlook.html
Your IT dept may not want to let you do this for security reasons. You should not seek to circumvent rules that you don't understand the implications of.
Replace your "Outlook Rule / Run a Script" with Items.ItemAdd Event (Outlook) and Items.Restrict Method (Outlook) to Filter Items by subject line.
Example
For those who wanna edit reg see https://stackoverflow.com/a/48778903/4539709