问题
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.
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
Here it is in the code.
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
Thanks
回答1:
Change .ActiveInspector to .GetInspector.
.GetInspector.CurrentItem.Actions("Reply to All").Enabled = False
.GetInspector.CurrentItem.Actions("Forward").Enabled = False
回答2:
Fixed It.
Need to display the Email first.
then .ActiveInspector.CurrentItem needs to be on Application not the item
so i used:
Set OutlMail = OutlApp.CreateItem(0)
.Display
'.......
End With
outlapp.ActiveInspector.CurrentItem.Actions("Reply to All").Enabled = False
outlapp.ActiveInspector.CurrentItem.Actions("Forward").Enabled = False
回答3:
You don't have to display the item first. Change the code to
OutlMail.Actions("Reply to All").Enabled = False
OutlMail.Actions("Forward").Enabled = False
来源:https://stackoverflow.com/questions/32560831/disable-outlook-reply-to-all-in-excel-vba