Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Every morning i receive an e-mail from a person, and it contains a spreadsheet attachment. I have managed to create an outlook rule that catch these e-mails. Now, is it possible to have the attachment from each of these automatically saved into a local folder, with the filename YYYY-MM-DD.xls?

The attachment in the mail has a randomly generated filename, so it needs to take the date of when the mail is sent to pick a filename. NB: this is on my laptop, so there's a chance that the e-mail is sent on a day other than the day it is received by me (such as when it's switched off for a day), so using "todays date" is not a viable option.

share|improve this question
    
What version of Outlook and what OS? –  CharlieRB Nov 12 '12 at 12:57
add comment

1 Answer

To do what you want, you will need to mix a little VBA and Rules together. Not sure what version of Outlook you are using, so no guarantees here. This was tested on Outlook 2010.

This article will help you get things setup -Rule to automatically save attachment in Outlook .

The code below is modified specific to your saving the file with the name format of yyyy-mm-dd.

Public Sub SaveToDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat

dateFormat = Format(Now, "yyyy-mm-dd")

'Change this path to the your folder location
saveFolder = "c:\temp\"

objAtt.SaveAsFile saveFolder & "\" & dateFormat & ".xls"

Set objAtt = Nothing

End Sub

Once you set up this rule to run this script, it will save any attachment from this person each time it receives one (and gives it a .xls extension). If you wish to change that, you will have to modify your rule or turn it off.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.