Outlook: Reply to HTML emails with plain text

Update: Alex remembered the add-in I ment: QuoteFix. Due to incompatibility issues with nowadays Outlook versions the guys published a VBA script doing mostly the same as the older add-in. Alex did some fine tuning on their script and applied parts of my snippet. Try his gist to get the best of both (mine and QuoteFix). Works like a charm for me.

When using Outlook to send/receive emails you usually press the reply (or reply all, forward) button to send back an answer. This works like a charm if the email you want to reply to was sent in plain text and you have the "line indention with prefix" option enabled in the Outlook settings.


Thus commenting the received email is pretty easy. Obviously there is no option to configure Outlook to reply to a HTML/RichText message with a plain text email too. So replying to such formatted mails with the "line indention with prefix" option enabled looks like this:


If you now try to write inline comments it is IMHO really hard for the recipient to find those in your reply. One might say: you can convert the reply message to plain text. Yes you can! But this won't convert the silly blue line into '>' prefixes. So I was looking for an add-in to solve this problem. I thought there was one I used in earlier Outlook versions, but couldn't find it anymore. After boongleing for an hour I decided to implement this using VBA. This is the result:

Enum AnswerType
    Forward = 0
    Reply = 1
    ReplyAll = 3
End Enum

Function DisplayPlainTextMessage(msg As MailItem, addPrefix As Boolean)
  Dim prefix As String
  If addPrefix = True Then prefix = "> "
  msg.BodyFormat = olFormatPlain
  Dim lines() As String
  lines = Strings.Split(msg.body, vbCrLf)
  Dim newBody As String
  For i = 0 To UBound(lines)
    If Trim(lines(i)) = "--" Then GoTo Break
    newBody = newBody & prefix & Trim(lines(i)) & vbCrLf
  msg.body = newBody
End Function

Function SendAsPlainText(how As AnswerType)
  On Error GoTo ErrorHandler

  Dim msg As Outlook.MailItem
  Set msg = GetMailItem

  If msg Is Nothing Then
    MsgBox ("No message selected.")
    GoTo ProgramExit
  End If
  Select Case how
    Case AnswerType.Forward
      Call DisplayPlainTextMessage(msg.Forward, msg.BodyFormat <> olFormatPlain)
    Case AnswerType.Reply
      Call DisplayPlainTextMessage(msg.Reply, msg.BodyFormat <> olFormatPlain)
    Case AnswerType.ReplyAll
      Call DisplayPlainTextMessage(msg.ReplyAll, msg.BodyFormat <> olFormatPlain)
  End Select

  Exit Function
  MsgBox Err.Number & " - " & Err.Description
  Resume ProgramExit
End Function

Sub ForwardAsPlainText()
  Call SendAsPlainText(AnswerType.Forward)
End Sub

Sub ReplyAsPlainText()
  Call SendAsPlainText(AnswerType.Reply)
End Sub

Sub ReplyAllAsPlainText()
  Call SendAsPlainText(AnswerType.ReplyAll)
End Sub

Function GetMailItem() As Outlook.MailItem

  On Error Resume Next

  Select Case TypeName(Application.ActiveWindow)
    Case "Explorer"

      If TypeName(ActiveExplorer.Selection.Item(1)) = "MailItem" Then
        Set GetMailItem = ActiveExplorer.Selection.Item(1)
      End If

    Case "Inspector"

      If TypeName(ActiveInspector.CurrentItem) = "MailItem" Then
        Set GetMailItem = ActiveInspector.CurrentItem
      End If
  End Select
  On Error GoTo 0
End Function

You can now modify your ribbon bar to add new buttons to the three subs ReplyAsPlainText, ReplyAllAsPlainText, ForwardAsPlainText: