Some users always move all the recipients except the original sender to “CC” field when using “Reply All” in Outlook. This article will introduce a method to automate the movement with Outlook VBA.
By default, when you select “Reply All” to reply an email, all the recipients who was originally in “To” field will be still placed in the “To” field in the replying mail. However, many users would like to move all the recipients to the “CC” field with only the original sender in “To” field. In response to this requirement, here we’ll expose a piece of VBA code, which can realize it automatically.
Auto Move All Recipients except Original Sender to “CC” Field in “Reply All”
- In the first place, launch your Outlook program.
- Then in the main Outlook window, press “Alt + F11” key buttons.
- Next you will enter the Outlook VBA editor.
- Subsequently, you ought to find and open the “ThisOutlookSession” project.
- Later you need to copy and paste the following VBA codes into this project window.
Public WithEvents objExplorer As Outlook.Explorer Public WithEvents objInspectors As Outlook.Inspectors Public WithEvents objMail As Outlook.MailItem Private Sub Application_Startup() Set objExplorer = Outlook.Application.ActiveExplorer Set objInspectors = Outlook.Application.Inspectors End Sub Private Sub objExplorer_Activate() On Error Resume Next If objExplorer.Selection.Item(1).Class = olMail Then Set objMail = objExplorer.Selection.Item(1) End If End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) If Inspector.CurrentItem.Class = olMail Then Set objMail = Inspector.CurrentItem End If End Sub Private Sub objMail_ReplyAll(ByVal Response As Object, Cancel As Boolean) Dim objReplyAll As Outlook.MailItem Dim objRecipient As Outlook.recipient Dim objCCRecipient As Outlook.recipient Dim strSender As String Set objReplyAll = objMail.ReplyAll strSender = objMail.SenderEmailAddress For Each objRecipient In objMail.Recipients 'Exclude yourself If objRecipient.Address <> "youremail@datanumen.com" Then 'Add the recipients as CC recipients Set objCCRecipient = objReply.Recipients.Add(objRecipient.Address) objCCRecipient.Type = olCC End If Next 'Keep original sender in To field objReplyAll.To = strSender objReplyAll.Display Cancel = True End Sub
- After that, you should sign this macro and then change your Outlook macro settings to permit digitally signed macros.
- Eventually you can restart your Outlook to activate the new VBA project.
- From now on, every time you reply emails using “Reply All”, you will see that all the recipients have been moved to “CC” field with only the original sender in “To” field.
Don’t Panic in Case of PST Corruption
If your PST file contains a lot of your valuable data, such as client information and so on, once your PST file gets corrupt, you must become worried. However, if you have backed up your file recently, you will never panic. The backups will enable you to get back your damaged Outlook data with effortless ease. But if there is no such backup, you still can use a potent recovery tool, such as DataNumen Outlook Repair.
Author Introduction:
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair sql and outlook repair software products. For more information visit www.datanumen.com
1
You yust copy the code into ThisOutlookSession or you need to add it to the code listed abowe? I have copy it directly to ThisOutlookSession and its not present at macro list.
Hornblower409
Could you give me all the code.
Hornblower409
I have inserted your code to outlook but it doesnt work.
I don’t understand why you are creating a new Response and canceling the original. I have very similar code, that seems to be working fine, that just changes the original Response. What am I missing?
{ Code to hook the Inspector/Explorer events}
{ Original is the item being replied to from the Inspector/Explorer}
Public Function ReplyAll_Fix(ByVal Response As Object, Cancel As Boolean)
‘ Walk the Reply Recipients
‘
Dim ResponseRecipient As Outlook.Recipient
For Each ResponseRecipient In Response.Recipients
‘ The Original Sender becomes To:
‘ All else become CC:
‘
If ResponseRecipient.Address = Original.Sender.Address Then
ResponseRecipient.Type = olTo
Else
ResponseRecipient.Type = olCC
End If
Next
End Function