Outlook宏,用于保存来自特定人员/以特定标题开头的邮件的附件



我需要编写一个Outlook宏,保存具有指定标题开头(例如:"Report.."(或指定发件人的邮件中的附件。我还没有在Outlook VBA中编程,所以我不知道如何开始。你能帮忙吗?

我相信这会满足您的需求。

Sub SetFlagIcon()
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set colItems = objFolder.Items
For Each objMessage In colItems
If objMessage.SenderEmailAddress = "someone@gmail.com" Then
intCount = objMessage.Attachments.Count
If intCount > 0 Then
For i = 1 To intCount
objMessage.Attachments.Item(i).SaveAsFile "C:your_path_hereDesktop" & _
objMessage.Attachments.Item(i).FileName
Next
End If
End If
Next
End Sub

请参阅下面的链接,了解其他一些想法。

https://www.extendoffice.com/documents/outlook/3747-outlook-auto-download-save-attachments-to-folder.html

https://www.pixelchef.net/content/rule-autosave-attachment-outlook

最新更新