使用 ActiveExplorer(不是 ActiveInspector)从 Outlook Mailitem 获取选定文本 [英] Get Selected Text from Outlook Mailitem using ActiveExplorer (not ActiveInspector)
问题描述
是否可以使用 ActiveExplorer 获取选定的文本?
Is it possible to get a selected text using ActiveExplorer ?
我见过的所有代码都使用 ActiveInspector,但就我而言,我需要使用 ActiveExplorer(又名预览窗格,如果我弄错了,请纠正我)
All codes I've seen around uses the ActiveInspector, but in my case I need to use ActiveExplorer (aka preview pane, correct me if I am mistaken, please)
我尝试使用以下方法,但没有成功
I've tried using the following, without success
GMID = Application.ActiveExplorer.Selection.Item(1)
推荐答案
以下(使用 Inspector)仍然适用于预览窗格:
The following (which uses Inspector) still works for the preview pane:
set item = Application.ActiveExplorer.Selection.Item(1)
MsgBox item.GetInspector.WordEditor.Application.Selection.Text
或者您可以使用 Redemption,它通过 SafeExplorer 对象(它还公开了功能区和其他一些好东西):
Or you can use Redemption, which explicitly exposes the preview pane through the SafeExplorer object (which also exposes the ribbon and a few other goodies):
set sExplorer = CreateObject("Redemption.SafeExplorer")
sExplorer.Item = Application.ActiveExplorer
MsgBox sExplorer.ReadingPane.SelText
Update 1/1/2021 - Outlook 的最新版本(2016 和 2019)公开了 Explorer.PreviewPane
属性,可用作
Update 1/1/2021 - the latest versions of Outlook (2016 and 2019) expose Explorer.PreviewPane
property, which can be used as
MsgBox Application.ActiveExplorer.PreviewPane.WordEditor.Application.Selection.Text
这篇关于使用 ActiveExplorer(不是 ActiveInspector)从 Outlook Mailitem 获取选定文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!