在Excel VBA中禁用Outlook全部回复
我有一个Excel VBAmacros,发送电子邮件给多个人。 我不想隐藏已发送给谁,我只是想禁用对Outlook的全部答复function。
我已经尝试了下面,从outlookVBA,它没有效果
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
谢谢
将.ActiveInspector更改为.GetInspector。
.GetInspector.CurrentItem.Actions("Reply to All").Enabled = False .GetInspector.CurrentItem.Actions("Forward").Enabled = False
修复。
首先需要显示电子邮件。
那么.ActiveInspector.CurrentItem需要在Application上不是该项目
所以我用:
Set OutlMail = OutlApp.CreateItem(0) .Display '....... End With outlapp.ActiveInspector.CurrentItem.Actions("Reply to All").Enabled = False outlapp.ActiveInspector.CurrentItem.Actions("Forward").Enabled = False
您不必首先显示该项目。 将代码更改为
OutlMail.Actions("Reply to All").Enabled = False OutlMail.Actions("Forward").Enabled = False