Skip to: Site menu | Main content

Login

Name: 
Password:
Remember me?
Register

Saving Attachments From Incoming Mail

written by Mark Rowlinson - Last updated May 2005

Place the following in your Outlook Session module and change the path to the location where attachments should be saved to:

 
Private Sub Application_NewMail() 
     
    Dim m As MailItem 
    Dim f As MAPIFolder 
    Dim a As Attachment 
    Set m = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.GetLast 
    Debug.Print m.Subject 
    For Each a In m.Attachments 
        a.SaveAsFile "C:Attachments\" & a.DisplayName 
    Next 
     
End Sub