Outlook VBA-获取当前活动(或打开)电子邮件的详细信息 [英] Outlook VBA - Get Details Of Current Active (Or Open) Email

查看:857
本文介绍了Outlook VBA-获取当前活动(或打开)电子邮件的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于如何检索当前已选择或已打开的电子邮件的详细信息,我完全陷于困境.实际上,我找不到有关如何访问电子邮件的任何详细信息.看来您可以遍历整个文件夹结构并获取所有电子邮件,但这对我没有帮助.

I am completely stuck as to how to retrieve details of an email which is either currently selected or open. In fact, I can't find any details on how to access an email. It seems you can traverse the entire folder structure and get all emails, but that doesn't really help me.

我不认为我可以得到一些指示吗?

I don't suppose I can get some pointers?

是的,我和下一个开发人员一样讨厌VBA,但不幸的是,我约有0.1%的工作涉及与Outlook的集成.

And yes, I hate VBA as much as the next developer, but unfortunately about 0.1% of my work involves integration with Outlook.

干杯.

推荐答案

通过查看

To get the currently selected emails by looking at the Selection object of the Explorer.

Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection

Set myOlExp = Application.ActiveExplorer
Set myOlSel = myOlExp.Selection

选择对象可以包含许多项目,还可以包含邮件(IPM.Note)以外的其他类型的项目(例如日历应用程序等).因此,如果您只想要邮件项目,则可以查看MessageClass项目

The selection object can contain many items and also contain Items that are of other types than mail (IPM.Note) i.e calendar apps etc. So if you only want mail items you can take a look at the item MessageClass

对于当前比较棘手的电子邮件,如果您只想获得最高级的电子邮件,则可以打开多个电子邮件,可以使用应用程序对象的检查员集合.然后,可以从检查器的 CurrentItem 属性中获取项目" (请记住,这些也可以是非邮件)

As for the current email that is trickier as you can multuiple of these open if you just want the top most you can use the Application.ActiveInspector otherwise you should look at the Inspectors Collection of the Application object. You can then get the "item" from the CurrentItem property off the Inspector(remember these can be non mails as well)

希望满满的东西会让你前进

Hope full that will get you going

这篇关于Outlook VBA-获取当前活动(或打开)电子邮件的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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