通过 VBA 在本地保存 Outlook 附件 [英] Saving outlook attachment locally via VBA

查看:171
本文介绍了通过 VBA 在本地保存 Outlook 附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在处理一个项目,但在本地保存电子邮件附件时遇到了一些问题.

I am currently working on a project, and I am having some trouble saving email attachments locally.

我目前设置了 Outlook 规则,可将所有相关电子邮件定向到 Outlook 文件夹.我想以编程方式提取所有这些电子邮件附件,并将它们全部保存到本地计算机上的一个文件夹中.

I currently have an outlook rule set up that directs all relevant emails to an Outlook folder. I want to programatically pull all of those email attachments, and save them all into one folder on my local machine.

如何将附件拉​​到指定位置?谢谢!

How do I go about pulling the attachments into a specified location? Thanks!

推荐答案

请尝试以下代码:

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

有关详细信息,请参阅自动保存 Outlook 附件

这篇关于通过 VBA 在本地保存 Outlook 附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆