在Excel VBA中禁用Outlook全部回复

问题描述:

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

i have a Excel VBA Macro that sends an email to multiple people. i don't want to hide who it has been sent to, i just want to disable the Reply to All function on outlook.

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

I have tried the below, from outlook VBA, and it had no effect

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

谢谢

修复了它.

需要首先显示电子邮件.

Need to display the Email first.

然后.ActiveInspector.CurrentItem必须位于应用程序上而不是项目上

then .ActiveInspector.CurrentItem needs to be on Application not the item

所以我用过:

Set OutlMail = OutlApp.CreateItem(0)

.Display
'.......
End With
outlapp.ActiveInspector.CurrentItem.Actions("Reply to All").Enabled = False 
outlapp.ActiveInspector.CurrentItem.Actions("Forward").Enabled = False