Cool forwards, Jokes, quotes, inspirational articles etc.

Thursday, July 21, 2011

[tech] Script to automatically save attachments in outlook

Hit Alt F11 in your outlook to bring in VBA

Go to project window and then expand to see ThisOutlook module

 

Then insert the below code:

 

Public Sub saveAttachtoDisk(itm As Outlook.MailItem)

 

Dim objAtt As Outlook.Attachment

 

Dim saveFolder As String

saveFolder = "C:\Temp"

 

For Each objAtt In itm.Attachments

objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName

Set objAtt = Nothing

Next

End Sub

 

 

***********Change the save folder path

 

Now go to outlook, setup a rule that meets your specifications like attachments of what type of mails should be saved. For action to be performed, choose run a script and select the above script.

 

You  are done.

No comments: