如何在网络共享中读取特殊类型的邮件

时间:2018-06-04 12:39:02

标签: vba outlook mailitem

从网络共享文件夹中选择的邮件项目具有奇怪的图标,与常规类型(附加图像)不同。它可能与报告收到的邮件的已读/未读状态有关。也许完全是一个不同的阶级。

如何在VBA中阅读此类邮件?

enter image description here

Dim oSel As Outlook.Selection

Set oSel = Outlook.Application.ActiveExplorer.Selection

Dim oEmail As Outlook.mailitem

Set oEmail = oSel.Item(1)    ' getting a 13 compile error in this line

1 个答案:

答案 0 :(得分:1)

You have a ReportItem object, not MailItem. Declare oEmail as a generic object, and either use the TypeName() function to figure out the actual object type or read the Class property (all Outlook objects expose it) - for MailItem objects it will be 43 (olMail).