在Excel VBA中禁用Outlook全部回复 [英] Disable Outlook Reply to All in Excel VBA

查看:124
本文介绍了在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

这篇关于在Excel VBA中禁用Outlook全部回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆