View Single Post
 
Old 12-11-2015, 12:28 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You can do it with a keyboard shortcut attached to the macro ProcessSelectedMessage (or run SaveAttachments as a script from a rule as the messages arrive, which needs no shortcut or further user involvement)

Code:
Option Explicit

Sub ProcessSelectedMessage()
Dim olMsg As MailItem
    On Error GoTo lbl_Exit
    Set olMsg = ActiveExplorer.Selection.Item(1)
    SaveAttachments olMsg
lbl_Exit:
    Exit Sub
End Sub

Sub SaveAttachments(Item As Outlook.MailItem)
Dim olAtt As Attachment
Dim strFileName As String
Const strPath As String = "C:\Path\"        'The path where the files are to be saved
    If Item.Attachments.Count > 0 Then
        For Each olAtt In Item.Attachments
            If Not olAtt.FileName Like "image*.*" Then
                strFileName = strPath & olAtt.FileName
                olAtt.SaveAsFile strFileName
            End If
        Next olAtt
    End If
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote