首页 > 解决方案 > 有没有办法将通过电子邮件在 Outlook 中收到的 excel 报告自动发送到文件夹?

问题描述

我通过 Outlook 收到每日 excel 报告。有没有办法让报告在每天或收到电子邮件时自动拖到文件夹中?示例 - 每天都会收到缺货报告,我希望 excel 每次都自动转到特定文件夹。

谢谢,

标签: exceloutlook

解决方案


你可以抛出 VBA 宏。

Outlook - File - Options - Customize Ribbon

标记“开发者”。在您可以在主菜单中看到“开发人员”之后。

在子菜单中查找 - Visual Basic

在新的 Project1 中单击鼠标右键并点击插入 - 模块。

放入带有以下注释的打开窗口宏:

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

按 保存Ctrl + S

之后,您需要为目标电子邮件创建规则。


推荐阅读