我尝试在发送消息时为其分配一个类别(“立即发送”类别以覆盖发送延迟)。在单独的窗口中编辑消息时,下面的宏工作正常,但当我尝试在阅读窗格编辑器中编辑消息时运行宏,它会挂在“Set msg = insp.CurrentItem”行,并显示错误消息“未设置对象变量或 With 块变量”。
当编辑器停靠时,如何正确引用它?是否有条件测试可用于测试正在使用的编辑器类型?
谢谢!
Public Sub SendNow()
Dim msg As Outlook.MailItem
Dim insp As Outlook.Inspector
Set insp = Application.ActiveInspector
Set msg = insp.CurrentItem
If insp.EditorType = olEditorWord Then ' outlook 2013
msg.Categories = "Send Now"
End If
msg.Save
msg.Send
Set insp = Nothing
Set msg = Nothing
End Sub
答案1
看一看:
Set exp = Application.ActiveExplorer
Set msg = exp.ActiveInlineResponse
If Not msg Is Nothing Then
...