'Rule-Triggered Script in Outlook No Longer Running

I'm kind of baffled as to why a script that has run seamlessly for me in the past is now throwing an error when triggered through an Outlook Rule. The intent behind this script is to save the email attachment in a specified folder and loop through the items in that same folder to delete any files from previous dates as well as any image files.

Script is as follows:

Public Sub SaveSalesForceReports(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
Dim sdate As Variant

sSaveFolder = "C:\Users\A6QDCZZ\Documents\SFReporting\Subscribed_Reports\" 'specify the folder where we will store our attachements that have been downloaded from the subscribed email reports
    For Each oAttachment In MItem.Attachments
        sdate = MItem.SentOn
        If Format(sdate, "DD-MM-YYYY") = Format(Date, "DD-MM-YYYY") Then
        oAttachment.SaveAsFile sSaveFolder & oAttachment.FileName
        End If
    Next oAttachment

Dim objFSO, objFolder, objfile As Object

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(sSaveFolder)

For Each objfile In objFolder.Files 'deletes older reports and clears extraneous files that may have been downloaded from the email
    If Format(objfile.DateCreated, "DD-MM-YYYY") <> Format(sdate, "DD-MM-YYYY") Then
        Kill objfile
    ElseIf InStr(Dir(objfile), ".png") > 1 Then
        Kill objfile
    End If
Next objfile

End Sub

For some reason unbeknownst to me, I'm now getting the following error: enter image description here

Can anyone help me understand what's happening?

Sincerely Appreciated!



Solution 1:[1]

An outlook update disabled the capability to run scripts. There is a registry hack that allows you to re-enable it as per this: https://www.slipstick.com/outlook/rules/outlooks-rules-and-alerts-run-a-script/

If you have done that, then you may need to edit the rule and check that the script is still listed there. Even if it is, I would try to edit the rule and reselect the macro to run.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 foosy