首页 文章

在 Excel VBA 中禁用 Outlook 全部回复

提问于
浏览
1

我有一个 Excel VBA 宏,可以将电子邮件发送给多个人。我不想隐藏已发送给谁,我只想在 Outlook 上禁用“全部答复”功能。

我已经从 Outlook VBA 中尝试了以下内容,但没有效果

ActiveInspector.CurrentItem.Actions("Reply to All").Enabled = False 
ActiveInspector.CurrentItem.Actions("Forward").Enabled = False

在代码中。

Set OutlMail = OutlApp.CreateItem(0)
On Error Resume Next
With OutlMail
    .To = sendto
    .Subject = "Update for: " & Date
    Set rng = Workbooks("UpdateV2.xlsm").Sheets("EmailP").Range("A1:S75")
    Call SortAbs
    Workbooks("UpdateV2.xlsm").Sheets("EmailP").Calculate

    .ActiveInspector.CurrentItem.Actions("Reply to All").Enabled = False 
    .ActiveInspector.CurrentItem.Actions("Forward").Enabled = False

    .htmlbody = "<body style=font-size:11pt;font-family:Arial bgcolor='#FBEDD4'>" & _

    "Please note that this email is Confidential. Do not forward." & _
    "<BR><BR> <i> This is an Automatic Email - Generated by: " & GetUserFullName & "</i> <BR><BR></body>" & RangetoHTML(rng)

    .Display
 End With
On Error GoTo 0
Set OutlMail = Nothing

谢谢

3 回答

  • 0

    将.ActiveInspector 更改为.GetInspector。

    .GetInspector.CurrentItem.Actions("Reply to All").Enabled = False
    .GetInspector.CurrentItem.Actions("Forward").Enabled = False
    
  • 0

    修复。

    需要首先显示电子邮件。

    则.ActiveInspector.CurrentItem 必须在应用程序上而不是项目上

    所以我用了

    Set OutlMail = OutlApp.CreateItem(0)
    
    .Display
    '.......
    End With
    outlapp.ActiveInspector.CurrentItem.Actions("Reply to All").Enabled = False 
    outlapp.ActiveInspector.CurrentItem.Actions("Forward").Enabled = False
    
  • 0

    您不必先显示该项目。将代码更改为

    OutlMail.Actions("Reply to All").Enabled = False 
    OutlMail.Actions("Forward").Enabled = False
    

相关问题