I'm often asked how to set Outlook to always reply in a specific format. While I don't recommend changing the reply format (because the sender choose the format for a reason), you can change it using a macro.
How do I set Outlook to always reply in HTML or RTF? When replying to, or forwarding, an email that is in plain text format, it always uses plain text. I want to force it to use RTF or HTML. I know I can change it every time, but I want it to be automatic.
The answer: Outlook does not offer a way to always use a specific format for all replies, be it RTF or HTML. You need to either change it on each message or write VBA macro to change the format. (You can force plain text replies to all messages by using the option to read all mail in plain text.)
We do not recommend always using HTML format (and certainly not RTF format) because you cannot be 100% sure that the sender is not using a smartphone or other device to read and reply to their mail. Many devices use plain text, either by default or as an option to the user and you should avoid changing the format on replies unless you have a valid reason - such as highlighting text, inserting tables or using bullet points. If you are replying with basic paragraphs of text, respect the sender's choice of plain text format.
Absolutely do not use RTF format for any message unless you know for a fact that the recipient will be reading it in Outlook (or OWA), otherwise they will get a plain text message and a winmail.dat attachment.
One of the readers of our Outlook Daily Tips mailing list posted the following macro. It was tested on Outlook 2007 and Outlook 2010 but should work on other versions.
Choose if you want to reply in HTML or plain text in this line:
'olFormat = olFormatPlain '(*1) - always use plain text
olFormat = olFormatHTML '(*2) - always use HTML
In the macro below, reply, forward, reply to all is generated using HTML.
If You want it to be in plain, comment out the HTML line and uncomment the plain text line, like this:
olFormat = olFormatPlain '(*1) - always use plain text
'olFormat = olFormatHTML '(*2) - always use HTML
And don't forget to disable macro warnings!
The Code
Copy and paste the code from this page into your ThisOutlookSession project.
In Outlook, press Alt+F11 to open the VBA editor and expand Microsoft Outlook Objects then double click on ThisOutlookSession to open it in the editing pane and Ctrl+P to paste the code.
This macro runs on application start up and monitors reply events. To test it without restarting, you can click within the Application_Startup macro and press the Run button in the Toolbar.
You'll also need to set macro security to allow the macro to run. While the low setting is OK for testing, we recommend using SelfCert to sign the macro if you are using it long-term.
Option Explicit
Private WithEvents oExpl As Explorer
Private WithEvents oItem As MailItem
Private bDiscardEvents As Boolean
Private olFormat As OlBodyFormat
Private Sub Application_Startup()
Set oExpl = Application.ActiveExplorer
bDiscardEvents = False
'olFormat = olFormatPlain '(*1) - reply using plain text
olFormat = olFormatHTML '(*2) - reply using HTML
End Sub
Private Sub oExpl_SelectionChange()
On Error Resume Next
Set oItem = oExpl.Selection.Item(1)
End Sub
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)
If bDiscardEvents Or oItem.BodyFormat = olFormat Then
Exit Sub
End If
Cancel = True
bDiscardEvents = True
Dim oResponse As MailItem
Set oResponse = oItem.Reply
oResponse.BodyFormat = olFormat
oResponse.Display
bDiscardEvents = False
End Sub
Private Sub oItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
If bDiscardEvents Or oItem.BodyFormat = olFormat Then
Exit Sub
End If
Cancel = True
bDiscardEvents = True
Dim oResponse As MailItem
Set oResponse = oItem.ReplyAll
oResponse.BodyFormat = olFormat
oResponse.Display
bDiscardEvents = False
End Sub
Private Sub oItem_Forward(ByVal Forward As Object, Cancel As Boolean)
If bDiscardEvents Or oItem.BodyFormat = olFormat Then
Exit Sub
End If
Cancel = True
bDiscardEvents = True
Dim oResponse As MailItem
Set oResponse = oItem.Forward
oResponse.BodyFormat = olFormat
oResponse.Display
bDiscardEvents = False
End SubAlways Reply using Plain Text, Change Header
This version of the oItem_Reply macro always replies using plain text and changes the header block at the top of the message from this:
-----Original Message-----
From: EMO [mailto:emo@slipstick.com]
Sent: Friday, November 18, 2016 3:14 AM
Subject: Exchange Messaging Outlook: Goodbye RPC over HTTP
To this:
On Fri, Nov 18, 2016 at 03:14:18, EMO wrote:
This macro will always use plain text. If you want to maintain the format and only change the header, use the code sample from In-line reply style in Outlook.
Option Explicit
Private WithEvents oExpl As Explorer
Private WithEvents oItem As MailItem
Private bDiscardEvents As Boolean
Dim oResponse As MailItem
Private Sub Application_Startup()
Set oExpl = Application.ActiveExplorer
bDiscardEvents = False
End Sub
Private Sub oExpl_SelectionChange()
On Error Resume Next
Set oItem = oExpl.Selection.Item(1)
End Sub
' Reply
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)
Cancel = True
bDiscardEvents = True
' these two lines change the format and add > to the plain text reply
oItem.BodyFormat = olFormatPlain
oItem.Actions("Reply").ReplyStyle = olReplyTickOriginalText
Set oResponse = oItem.Reply
afterReply
End Sub
Private Sub oItem_Forward(ByVal Response As Object, Cancel As Boolean)
Cancel = True
bDiscardEvents = True
' these two lines change the format and add > to the plain text reply
oItem.BodyFormat = olFormatPlain
oItem.Actions("Forward").ReplyStyle = olReplyTickOriginalText
Set oResponse = oItem.Forward
afterReply
End Sub
Private Sub oItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
Cancel = True
bDiscardEvents = True
' these two lines change the format and add > to the plain text reply
oItem.BodyFormat = olFormatPlain
oItem.Actions("Reply to All").ReplyStyle = olReplyTickOriginalText
Set oResponse = oItem.ReplyAll
afterReply
End Sub
Private Sub afterReply()
Dim datestr As String
Dim orgBody As String
Dim myBody As String
Dim newBody As String
Dim name As String
Dim pos
Dim b
Dim Lines
Dim myLine
bDiscardEvents = True
' Delete the signature from the top of the message
Dim objDoc As Object 'Word.Document
Dim oBookmark As Object 'Word.Bookmark
On Error Resume Next
Set objDoc = oItem.GetInspector.WordEditor
Set oBookmark = objDoc.Bookmarks("_MailAutoSig")
If Not oBookmark Is Nothing Then
oBookmark.Select
objDoc.Windows(1).Selection.Delete
End If
'if you want to add a signature at the end
'Set objFSO = CreateObject("Scripting.FileSystemObject")
''Edit the signature file name on the following line as needed'
'Set objSignatureFile = objFSO.OpenTextFile("C:\path-to-signature.txt")
'sig = objSignatureFile.ReadAll
'objSignatureFile.Close
name = oItem.SentOnBehalfOfName
datestr = Format(oItem.SentOn, "DDD, MMM dd, yyyy at HH:mm:ss")
' - Remove Outlook-style reply header
orgBody = oResponse.Body
pos = InStr(orgBody, ">") - 1
myBody = Mid(orgBody, pos + 1)
b = 0
Lines = Split(myBody, vbNewLine)
For Each myLine In Lines
If b > 4 Then
newBody = newBody & myLine & vbNewLine
End If
b = b + 1
Next
' Put new body together
oResponse.Body = "On " & datestr & ", " & name & " wrote:" _
& vbNewLine & newBody & vbNewLine '& sig
oResponse.Display
bDiscardEvents = False
'close the message you are replying to without saving changes
' (it was converted to plain text)
oItem.Close olDiscard
End Sub
How to use the Macro
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security. If Outlook tells you it needs to be restarted, close and reopen Outlook. Note: after you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Now open the VBA Editor by pressing Alt+F11 on your keyboard.
To use the macro code in ThisOutlookSession:
- Expand Project1 and double click on ThisOutlookSession.
- Copy then paste the macro into ThisOutlookSession. (Click within the code, Select All using Ctrl+A, Ctrl+C to copy, Ctrl+V to paste.)
Application_Startup macros run when Outlook starts. If you are using an Application_Startup macro you can test the macro without restarting Outlook by clicking in the first line of the Application_Startup macro then clicking the Run button on the toolbar or pressing F8.
More information as well as screenshots are at How to use the VBA Editor.
Brian Kelly says
Many thanks for this--it was an excellent example that helped me to implement this. I would note that it does not support the Use Case where someone Declines a Meeting Request and you want to respond to their Decline note, because it does not handle MeetingItems, but that was relatively easy to fix once I figured that out--just need a similar oMeetingItem object as the oItem object in the example above. I also modularized it such that the real meat of the code is in one function that is called by the various event handlers.
One issue that I hit, however, is that when this is implemented, the content of the Reply is all considered "new text", which means that when I hit send and the spellchecker kicks in, it does not check solely my actual reply, but the entire thread, even though the "Ignore original message text in reply or forward" is checked.
I will look into determining if there is a way to prevent that, but if anyone has any ideas how I can avoid this, I would love to hear them.
Thomas Kahn says
Sadly this script did not work for me in Outlook 2019. But using AutoHotkey I got it to work. As soon as I open a plain text message AHK quickly switches to the Format menu, selects HTML and switches back, it's barely noticable. This script can be found in this thread on the Microsoft Forum:
https://social.technet.microsoft.com/Forums/ie/en-US/d55e55d5-f8d4-4358-85cc-cc17d5d92b51/outlook-2010-always-reply-using-html-format-option
Search for AutoHotkey.
Kalan says
I would really like to know what smartphone can't read HTML email... It's 2017 all Android and iOS phones can read HTML, also if your webmail can't read HTML email you need to have your provider change that ASAP.
Diane Poremsky says
there are still a few that can't do HTML but it's not just about the device supporting it, it's also the "cost" of html in data. My sister does not have unlimited data and her only internet access is through the phone; converting her messages to html would add about 10 kb to each message. It's not just cellular providers who set data limits - not everyone has unlimited data.
Jim says
Thanks for the excellent post, and promising code. I am getting an error though: Compile error: Invalid attribute in Sub or Function
The highlighted line is WithEvents oExpl As Explorer
Any idea what my issue is?
Running Outlook 2013.
Steve Sybesma says
forgive the dumb question; I was able to follow the instructions up to the point of copy and paste into the Alt + F11 window and it saved, but the macro didn't seem to be created; I'm using Outlook 2016
Diane Poremsky says
This macro runs when you click the Reply /Reply all buttons - it won't be listed in the Macro selector on the developer tab.
Rossy001 says
Hello Diane. Thank you for this! I have successfully implemented your code, except not the "Change the Reply Font" code you provided, quoted here again. Where do I insert this code, please?
oResponse.HTMLBody = " " & oResponse.HTMLBody
Diane Poremsky says
Add the line between these if there is a not a line that sets the HTMLBody already in the code.
oResponse.BodyFormat = olFormat
oResponse.Display
Kevin says
Thanks for this code snippet. Was able to get it to work after turning on the "reply in new window" setting. However, now my email footer is being reformatted to a different font (times roman).
Diane Poremsky says
That is the plain text font you have set? It's expected because the signature is added before the format is changed. I don't think there is anyway to avoid it. Sorry.
John Batts says
Thank you for this post. I hope that there is something that can be modified to allow me to bypass the problems that I have.
Specifically, there are instances where my Reply to a message assumes some formatting from the original message, causing the spacing between paragraphs to be abnormally big. Additionally, when I Reply to a message from someone in South Korea, the lines become justified and then break the words at irregular spots without hyphenation.
I can correct this by choosing Format Text-->Styles-->Change Styles-->Style Set-->Reset to Quick Styles from Template
I would love it if there was a way to automatically do this! It only impacts HTML-based messages - I don't recall seeing this issue if the original post was a pure text-based message. And I don't necessarily want to override from Text to HTML, out of respect for the recipient. But I don't want to have to do the process described above every time I type a message to one of those problematic recipients.
Thank you!
Thank you!
Martin says
Hi, this is working great for me.
I'm wondering if you can provide some code to force any new emails to automatically select HTML?
I know there is an option for setting a default, however, my company in its wisdom has decided to lock that to plain text (they live in the past), which is a pain as formatting can help convey key information quickly.
Thanks in advance.
Diane Poremsky says
The easiest way is to use this macro: https://www.slipstick.com/developer/create-a-new-message-using-vba/ and create a button on the ribbon for it - use it instead of the new message button. Delete all of the with objmsg lines except bodyformat and display.
With objMsg
.BodyFormat = olFormatHTML
.Display
End With
Ben says
Thanks! I turned off the reading pane compose option (File -> Options -> Mail -> Replies and forwards -> Check 'Open replies and forwards in a new window' option) and now it works.
Ben says
Sorry I thought I replied, but the comment system seemed to glitch: It's opening a new window, but it's still using html. Any thoughts?
Diane Poremsky says
Ok... it looks like its a problem with the reading pane compose feature - if i open the message then reply, the macro works. If i turn off reading pane compose, the macro works.
Ben says
Thanks for the quick reply. It's opening a window to reply (even though the option to use reading pane reply is enabled), but it's still html. My code has:
olFormat = olFormatPlain '(*1) - reply using plain text
'olFormat = olFormatHTML '(*2) - reply using HTML
I followed the suggestion given by @David Lee here, https://techniclee.wordpress.com/2012/08/02/how-to-force-all-plain-text-messages-to-html-format/, about inserting the code 'Msgbox "Macros are enabled."' into the startup to confirm that Macros are enabled, and they are.
I'm running Office 15.0.4701.1002 on Windows 7 (32 bit). Any ideas?
Diane Poremsky says
Opening a new window is normal with the code - reading pane compose is not fully supported by vba.
Hmm. it's not converting messages on my outlook 2013 system either. I'll look into it.
Ben says
I also can't get this to work on Outlook 2013, even after restart. I've checked that macros are set to run, but when I try to always reply in plain text (changing the comment line in the code), it still opens a reply window in html. Any thoughts?
Diane Poremsky says
is it opening a window or using the reading pane reply? The macro should open in a new windows when it runs, even if the option to use reading pane reply is enabled.
Josiah Kuenzi says
Hi Diane,
Some executive users I support showed me an issue in replying to messages that were delivered to them in plain text format. The end goal is for the recipients to easily see their response notes. After hitting reply, they immediately change the format from Plain Text to HTML so that their comments will be inserted prefaced by [Name in Brackets] and in another color automatically as they have it set to do in the Outlook Mail Options.
The problem is this setting (Signatures and Stationery | Replying or forwarding messages | font color | mark my comments with: JMK) only works with messages originally sent in HTML. Even when switching immediately to HTML upon clicking reply, the color is NOT applied although [Name in Brackets] does get inserted and the bold and italics formatting is applied.
We have tested this in Outlook 2007, 2010, and 2013 and it seems to be broken in all versions as the automatic coloring is not applied. They want it to be efficient, quick, and automatic so they don't have to spend time manually highlighting and formatting the color of all their responses.
Thank you for your help!
Diane Poremsky says
I swear I answered this already, unless I started to and the browser crashed before I posted it. :) You can use a run a script macro to change the format of the messages as they arrive or use one that changes it before the message is opened for reply - but if you do this, the 'mark my replay' name is not inserted - but the font color is changed and the signature added.
Code sample is here - selectively-change-message-format-replying that changes it before the reply, or use a run a script rule.
The non-code way is to change the format using Edit Message, then change the format and hit reply.
BOB says
WHEN TRYING TO "RUN" IT ASKS FOR MACRO NAME????
Diane Poremsky says
You need to click in Application_startup and click Run then when you hit Reply or Reply all button, the macro will run.
Alonzo says
what is the code to always put your signature in.
Diane Poremsky says
What version of Outlook? The signature is not exposed in the object model so you need to call another macro, such as the one here: http://www.outlookcode.com/codedetail.aspx?id=1743
ej says
I've been looking for this solution for a long time.. It's a real pain in the a**.
1. I'm not techy and I don't know what to do with the code once i paste it.. anyone?
2. Is there also a code to make it HTML when forwarding ?
Thanks !
Diane Poremsky says
The code includes macros for reply, reply all and forward.
Paste it into ThisOutlookSession then click in the application_StartUp macro and press the run button.
Oh, and you need to set macro security to low. In Outlook 2010/2013, go to File, Options, Trust center, macro security to change the setting.
Christoph says
Thanks for this script.
I'm using it but when I reply to an email, the font changes to Times New Roman.
I need Verdana, 10pt, grey. How can I change that?
In the settings of Outlook 2010 are the right font settings.
Diane Poremsky says
This happens because Outlook uses word as the editor - you can change the font fairly easily, but changing the font size is a little more complicated and i don't have a sample that does that. You'll add the oResponse.HTMLBody line as shown in this snippet - and can remove the bodyformat line.
Dim oResponse As MailItem
Set oResponse = oItem.Reply
oResponse.HTMLBody = " " & " " & oResponse.HTMLBody
oResponse.Display
bDiscardEvents = False
zsolt says
This code does not work, there is a synthax error in the font definition line and also in. bDiscardEvents = False
D Poremsky says
it looks like the conversion from WordPress to Disqus messed the code up. Every "&" should be "&" - it was converted to the html code for &. (The = multiplied too.)
D Poremsky says
The correct code (assuming it doesn't get messed up again) is
[code]oResponse.HTMLBody = "<font face=" & Chr(34) & " verdana" & Chr(34) & "> <font color=" & Chr(34) & " green" & Chr(34) & "> " & oResponse.HTMLBody[/code]
The 2 closing font tags were added by the web software too. Outlook will rewrite the color tags to CSS and properly close the tags when you hit Send.
I updated the article to include this line of code.
josh wilson says
i love the the above code, any way to insert me signal to it
Adam Smith says
Here is my VBA code to do this: https://gist.github.com/3458680
This code is superior to the other VBA code because the VBA code to change to HTML format used by the other code messes up the formatting of the draft, and this code doesn’t need to hook every item that you view in Outlook.
Chris says
okay so this works - it will reply permanently in html = great. A reply to an email originally in text will now be replied to in html ..
BUT .. what about adding of a working html signature after the email reply has been set to html? .. how can this be done in your macro above?
Diane Poremsky says
The signature is added before the conversion - the only way around it is to not add an automatic signature.
Andy Wright says
Thanks for this, with the altering of Macro security this now works just fine.
I had the problem mentioned by other poster whereby the signiature is inserted in plain text not HTML.
My way round the problem is to set outlook to not automatically add a sig to replies.
I then click reply and then click insert signiature
The sig has a few lines of text in my preferred font above the sig image, so I can then just click in that section and start typing in the desired font.
Yes this is a bit of a faff, but it leaves me with $30 to spend on beer instead :)
Diane Poremsky says
Beer is better than outlook. :) Depending on your version of Outlook, you can customize the toolbar, ribbon, or QAT to make the Insert signature command a step away, reducing your effort further.
Diane Poremsky says
James, what is your macro security setting? While we don't recommend using the low/run all macros setting all the time, you can set it to low to test the macro. If it works, we know its security, not the code.
To test, set macro security to low then open the VBA editor, click within the application start up macro and click the Run button to kick start it.
James says
Didn't work, even w/ restart.
Diane Poremsky says
Lucian:
According to a user on my original blog where this was first posted: “I had my own fonts but they kept changing to the default “Times New Roman”. A small change to the code fixed that for me."
Just flip the order of the following code:
oResponse.BodyFormat = olFormat
oResponse.Display
to
oResponse.Display
oResponse.BodyFormat = olFormat
For an alternate method using Autohotkey, see the comment by GPNolan, https://www.outlook-tips.net/outlook-email/change-...
Lucian says
Did not work for me too. Until I Looked at the code to debug and realized the program needs to be restarted.
Restart Outlook to take affect.
The only Problem I have know is changing the font as I don't like the one it is using but at least its better then Plain Text
Mike says
Did not work for me either, nothing happens
Mark says
I found this page in the search for making all my replies HTML so that I could always include my classy html signature with image links for self-promotion purposes.
I simply hate the vba editor and all the silly macro stuff, I always seem to get some error message. I fiddled round for hours trying to get this script (and another modified one on some other site) to work, but at best, it would make the font Times New Roman no matter what order of those two lines there, and my html signatures still don't work fully anyway, which was the whole point of the exercise. So it's not really very adequate.
But I found a cool solution, albeit a commercial one: a brilliant third-party outlook add-on, bells & whistles: http://www.emailaddressmanager.com/outlook-bells.html. 30 bucks was worth it for me. it does some other cool things which I'm using now too.
It does the change from plain text to html in some other way which is as if you clicked the html button in the ribbon on every email. I guess it loads the macro at the loading of every new message reply. And what satisfies my needs is its signature option. voila!
it very smartly inserts the third party html signature that you make and assign, as a second step after the change to html. so it's PERFECT in other words!!!!!
hope my comment helps someone out there.
Paul says
Didnt work.
Ben says
Hi
We still cannot get the HTML Signature to come up when using this code. The code does work and i can confirm the email is now in HTML, but its still using the plan text version of the sig?
Any way to fix this?
Diane Poremsky says
Based on discussions with Outlook developers, they believe the signature is added before the code makes the conversion.
Right click on the signature - do you see the signature menu or the standard context menu?
marie h w hut says
ik ging naar Bar le Duc water en wilde een email versturen,maar kreeg iets met replycode niet goed of zo telenet 220 met 2 namen beide telenet.Vandaar mijn zoektocht wat is reply code Zag er 2 replycode Alpha en reply invalid codes.Ik ben geeindigd met snap er niks van vr.gr.mariehut
Diane Poremsky says
Something may have gotten lost in translation... but if i understand it correctly, you couldn't send an email while using public internet? This is common - many sites block smtp port 25 and make you use a different one or authenticate with your server. If its something else, sorry :(
Nasar says
Thanks for this.
I have save the code exactly as it says above into this ThisOutlookSession project in Outlook 2010. But how do i run this? When i click ALT+F8 it comes up empty. Also when i open a plain text email and click reply or reply all it still opens up as Plain text instead of HTML which is what i want. Appreciate all your help
Diane says
It runs automatically when you reply to a message. You also need to have macro security set to medium or sign the macro. (Medium, warn for all macros, is better for most users or while tweaking macros.) Set macro security to medium and restart outlook. A VBA dialog will comes up, ok it and then the macro should work.
dianep says
Another comment from the old blog, author unknown:
"Very nice piece of code. However, I had my own fonts specified and by running this, they kept changing to the default "Times New Roman". A small change to the code fixed that for me.
Just flip the order of the following code:
oResponse.BodyFormat = olFormat
oResponse.Display
to
oResponse.Display
oResponse.BodyFormat = olFormat
and my own specified font formats stays. It takes less than a fraction of a second to change the format. So displaying it first does not cause any problem. "
Tony D. says
This works great on Outlook 2010 (14.0) 32 bit version except that my custom fonts on the signatures do not propagate. HTML yes, my fonts and colors no. Any ideas?
Diane Poremsky says
Are you using the
oResponse.Display
oResponse.BodyFormat = olFormat
change?
I'll have to check it, but it could be because the signature is added before the conversion.
Tony D. says
Yes I made that change in all 3 places.
I also found both the original and changed version will not run under 64bit Outlook 2010 :/
Thanks for you help!!
dianep says
Yes, according to the comments in the original post, it does work in Outlook 2003 (along with 2007 and 2010, which i tested it with).
Todor says
tested on 2003?