Extract Attachments Macro in Outlook

davysewell

Board Regular
Joined
Oct 4, 2006
Messages
92
Eveing everyone,

I know this message board is supposed to be about Excel only but I can't find anyone else who can help me.

I'm looking for a macro for Outlook 2003 that will save all of the attachments to the current folder in Outllook and then move the original mail in to a folder call "Done"

I'm brand new to Outlook and there aren't many guides so I am not sure if this is possible.

If someone could help me I'd be eternally grateful!

Sorry for bending the rules!

Dave
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try this script. All attachments will be saved to C:\temp folder. Original mails will be moved subfolder under inbox called Done.

I think you need to put this script into Outlook rather than Excel. But you can try both ways.

Code:
Sub SaveAllAttachments()
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
'Link to subfolder called Done under Inbox.
Set MyDestFolder = objFolder.Folders("Done")
Set colItems = objFolder.Items
For Each objmessage In colItems
    intCount = objmessage.Attachments.Count
    If intCount > 0 Then
        For i = 1 To intCount
            objmessage.Attachments.Item(i).SaveAsFile "C:\Temp\" & _
                objmessage.Attachments.Item(i).Filename
        Next
        objmessage.Move MyDestFolder
    End If
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,207,424
Messages
6,078,448
Members
446,339
Latest member
keogata

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top