excel - 有没有办法将通过电子邮件在 Outlook 中收到的 excel 报告自动发送到文件夹?
问题描述
我通过 Outlook 收到每日 excel 报告。有没有办法让报告在每天或收到电子邮件时自动拖到文件夹中?示例 - 每天都会收到缺货报告,我希望 excel 每次都自动转到特定文件夹。
谢谢,
解决方案
你可以抛出 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。
之后,您需要为目标电子邮件创建规则。
推荐阅读
- php - 正则表达式 - 不同字符串长度的不同检查
- javascript - 是否可以在 JavaScript 中直接将文本发送到剪贴板
- scrapy - 如何在scrapy上从另一只蜘蛛中调用一只蜘蛛
- javascript - 链接点击后如何在url中隐藏id?
- javascript - UserScript 使 Textarea 框可扩展
- javascript - Owl Carousel with Magnific Popup - 弹出窗口甚至不显示,不知道我做错了什么
- assembly - 为什么要为缓冲区溢出将偏移量的值增加 4?
- ios - Xcode 版本 12.2 未部署在 iOS 14.1 设备上。“xxx 的 iPhone 不可用。”
- sql - 如何按结果表从组中仅选择一组行?
- android - 安装前如何在 AVD Manager 上检查设备的 Android 目标平台?