A visitor to the Microsoft Answers forum asked about forwarding a message and automatically CCing the message to the original recipients. While I would use Reply All and add the new person's address to the message, it is possible to do this using VBA. This quick macro shows how.
You'll need to create a button on the ribbon or QAT for the macro. While you could use a different method and watch for the Forward button to be clicked, that method would hijack all forwards. This method works only on the messages you want to use it on. Note that, as written, this macro will include your address in the message. To avoid this problem, you would need to test the recipients and remove your address.
As always, macro security needs to be set to low.
Open the VBA editor using Alt+F11, right-click on Project1, choose Insert > Module. Paste the code in the new module. Create a ribbon or QAT button for the macro.
Select a message and run the code.
Public Sub ForwardwithCC() Dim strRecip As String Dim objMsg, oMail As MailItem ' For a reply or reply all, replace forward with Reply or ReplyAll Set objMsg = ActiveExplorer.Selection.Item(1).Forward If TypeName(ActiveExplorer.Selection.Item(1)) = "MailItem" Then Set oMail = ActiveExplorer.Selection.Item(1) On Error Resume Next For Each Recipient In oMail.Recipients strRecip = Recipient.Address & ";" & strRecip Next Recipient objMsg.CC = strRecip & ";" & oMail.SenderEmailAddress objMsg.Display Else End If Set objMsg = Nothing End Sub
Karim's version of the code
Karim posted a modified code sample in the comments that exclude your own address, using an extra If statement. He also added the the Recipients to the To field, instead of CC and changed the subject form "FW" to "RE".
Public Sub ReplyToAllWithAttachment() Dim strRecip As String Dim objMsg, oMail As MailItem Dim user As String ' For a reply or reply all, replace forward with Reply or ReplyAll Set objMsg = ActiveExplorer.Selection.Item(1).Forward If TypeName(ActiveExplorer.Selection.Item(1)) = "MailItem" Then Set oMail = ActiveExplorer.Selection.Item(1) On Error Resume Next user = Application.Session.CurrentUser For Each Recipient In oMail.Recipients If Recipient = user Then GoTo 1: Else strRecip = Recipient.Address & ";" & strRecip End If 1: Next Recipient objMsg.To = strRecip & ";" & oMail.SenderEmailAddress 'change subject FW -->; RE objMsg.Subject = "RE: " & Mid(objMsg.Subject, 5) objMsg.Display End If Set objMsg = Nothing End Sub
How to use the macros on this page
First: You need to have macro security set to the lowest setting, Enable all macros during testing. The macros will not work with the top two options that disable all macros or unsigned macros. You could choose the option Notification for all macros, then accept it each time you restart Outlook, however, because it's somewhat hard to sneak macros into Outlook (unlike in Word and Excel), allowing all macros is safe, especially during the testing phase. You can sign the macro when it is finished and change the macro security to notify.
To check your macro security in Outlook 2010 and newer, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, look at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Macros that run when Outlook starts or automatically need to be in ThisOutlookSession, all other macros should be put in a module, but most will also work if placed in ThisOutlookSession. (It's generally recommended to keep only the automatic macros in ThisOutlookSession and use modules for all other macros.) The instructions are below.
The macros on this page should be placed in a module.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor
Thanks for the code.
One question. The Script works great but I get some wired thing/letters/codes or whatever it is in the CC and after click on "Check Names" button, then Outlooks recognise the emails address properly. Is there a little script avoid clicking on "Check Names" button?
Thank you in advance.
hi,
Many thanks... This is a amazing macro that every outlook should have by default.
To exclude your own address, see code below (extra if statement). I also placed the Recipients in To, instead of CC and I have changed the subject form "FW" to "RE"
I would like to use the solution that Karim proposes but it gives me an error. Can anyone clean that up, so it doesn't copy myself?
Try this text file - the website software can't mess up the code on it. :)