【发布时间】:2016-11-16 15:04:15
【问题描述】:
我试图在阅读窗格中突出显示特定文本,因此当您单击特定电子邮件时,阅读窗格将显示电子邮件的正文并突出显示指定的文本,在本例中为“测试”一词。
目前,什么都没有发生。
如果我双击电子邮件在新窗口中打开它,阅读窗格中它后面的预览现在会正确突出显示。
似乎事件在打开而不是预览时触发,然后更改对不再位于顶部的窗口生效。
Public WithEvents myItem As Outlook.MailItem
Private Sub Application_ItemLoad(ByVal Item As Object)
If Item.Class = olMail Then
Set myItem = Item
End If
End Sub
Private Sub myItem_Open(Cancel As Boolean)
EventsDisable = True
Dim msg As Outlook.MailItem
Dim insp As Outlook.Inspector
Set insp = Application.ActiveInspector
If insp.CurrentItem.Class = olMail Then
Set msg = insp.CurrentItem
If insp.EditorType = olEditorWord Then
Set hed = msg.GetInspector.WordEditor
Set appWord = hed.Application
Set rng = appWord.Selection
rng.Find.HitHighlight ("Test")
End If
End If
Set appWord = Nothing
Set insp = Nothing
Set rng = Nothing
Set hed = Nothing
Set msg = Nothing
EventsDisable = False
End Sub
【问题讨论】:
标签: vba email outlook outlook-2013