【发布时间】:2019-08-31 03:36:27
【问题描述】:
在 Outlook 2016 停靠时尝试设置活动 MailItem 的敏感度时出现以下错误。弹出电子邮件时,我的代码的“Else”部分有效。
Error message:
Run-time error "-2082340855 (83e20009)
该对象不支持此方法。
您可以从我附加的屏幕截图中清楚地看到 msg 变量显然是一个“MailItem”。
更新:这是工作代码:
Sub ToggleConfidentialSensitivity()
On Error Resume Next
Dim msg As Outlook.MailItem
If Application.ActiveInspector Is Nothing Then 'we are in the main window (inline)
Set msg = Application.ActiveExplorer.ActiveInlineResponse
Else 'we are in a popped out message
Set msg = ActiveInspector.CurrentItem
End If
If msg.Sensitivity = olConfidential Then
msg.Sensitivity = olNormal
msg.Subject = Replace(msg.Subject, "*Confidential* ", "")
MsgBox ("This email is now marked as public")
Else
msg.Sensitivity = olConfidential
msg.Subject = "*Confidential* " + msg.Subject
MsgBox ("This email is now marked as Confidential")
End If
End Sub
【问题讨论】:
标签: vba outlook outlook-2016