I have VBA code to download attachment immediately after mail comes into Outlook.
How do I invoke this code or is there another way to download attachments automatically?
Sub saveAttachtoDisk(itm As Outlook.MailItem)
    Dim saveFolder As String
    saveFolder = "D:\outlook\"
    For Each objAtt In itm.Attachments
        MsgBox objAtt
        objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
        MsgBox saveFolder & "\" & objAtt.DisplayName
        Set objAtt = Nothing
    Next
End Sub
 
     
    