-1

I receive daily excel report via outlook. Is there a way to have the report automatically dragged to a folder on daily bases or when I receive the email ? Example - Out of stock reports gets to us on daily , I want that excel goes to a specific folder every time automatically .

Thank you,

  • https://stackoverflow.com/a/29910853/4539709 – 0m3r Feb 10 '21 at 20:19
  • Sub Macro1() ' ' Macro1 Macro ' ' Dim olApp As Outlook.Application Set olApp = CreateObject("Outlook.Application") Dim olMail As Outlook.MailItem Set olMail = olApp.CreateItem(olMailItem) olMail.To = "Jalalbcit@gmail.com" olMail.Subject = "Subject Line " olMail.Body = "This is the body of the email" olMail.Send End Sub – Jalal Mirahmadi Feb 16 '21 at 06:47

1 Answers1

0

You can do it throw VBA macros.

Outlook - File - Options - Customize Ribbon

Tag "Developer". After you can see "Developer" in main menu.

Find in submenu - Visual Basic

In new Project1 click by right mouse button and tap Insert - Module.

Put in open window macros with comments below:

Public Sub saveAtt (itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment 'var for work with attachments
Dim saveFolder As String 'var for dest folder
Dim sDateMail as string 'var for email date
'save in right format email time
sDateMail = Format(itm.CreationTime, "hh-mm-ss_dd.mm.yyyy")
'set dest folder
saveFolder = "C:\Users\John Doe\Desktop\"
'sort all attachments in memail
For each objAtt in itm.Attachments
'save attachment in folder with name: email_date + attachment_filename
objAtt.SaveAsFile saveFolder & "\" & sDateMail & "_" & objAtt.FileName
'clear var for work with attachments
Set objAtt = Nothing
Next objAtt
End Sub

Save by pressing Ctrl + S.

After that you need to Create Rule for target email.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
IonPAX
  • 16
  • 1
  • Thank thank you IonPAX , Is there a way to specify which email to take it from - the email always have the same subject and coming from same sender " – Jalal Mirahmadi Feb 10 '21 at 21:09
  • macros just helps to you save attachment in destination folder. You can set all sorts and filters by Outlook service "Creating Rule" for incoming emails. – IonPAX Feb 11 '21 at 05:41