i bumped onto this simple save attachment code for outlook.

however, with newer updates for Outlook, Rules will not work on script.

How can this code run on-demand, or via a button?


purpose is simple: to extract attachment and append the receivedtime datecode.

thanks!

Public Sub saveAttachtoDisk(itm As Outlook.MailItem)    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
        saveFolder = "C:\PathToDirectory\"
    Dim dateFormat As String
        dateFormat = Format(itm.ReceivedTime, "yyyy-mm-dd Hmm ")
    For Each objAtt In itm.Attachments
        objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
    Next
End Sub