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:

Voxel engine in Silverlight 3 - Homage to .NET Open Space 2009

Back in the early days of computer gaming one may remember the Comanche flight simulator. The simple 3D engine used for this and other games is based on a so called voxel rendering engine. Searching the Internet for this technique I found this nice article from Alex Champandard and this one from Codermind. Putting two and two together, again I paid attention to the WriteableBitmap class that is part of Silverlight 3.

To emphasize the .NET Open Space 2009 that is starting tomorrow here in Leipzig, I used a special background texture for the sky. Just press the start button and use W-A-S-D of your keyboard to fly around the terrain. I will clean up the sources after the upcoming and put it here on my blog. So stay tuned.

[ ![Get Microsoft Silverlight](https://go.microsoft.com/fwlink/?LinkId=108181) ](https://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0)

Fire with WriteableBitmap

Playing around with the new WriteableBitmap class in Silverlight 3 I remembered the time I started with VGA programming in assembler. After a quick research I found this simple algorithm to visualize the effect. I added the interactivity via mouse click and keyboard input to create new fire initiators.

[ ![Get Microsoft Silverlight](https://go.microsoft.com/fwlink/?LinkId=108181) ](https://go.microsoft.com/fwlink/?LinkID=124807)

The source is available for free: FireEffect.zip (12 kB)

Release of Silverlight Whiteboard


After a long run on a bumpy road our Trian.Whiteboard finally found it’s way to the MSDN Code Gallery. Even if Microsoft Silverlight 3 is knocking on our doors this smart sample is a good start to get in touch with this technology. It shows how to use XAML to create a Rich Internet Application that communicates with a Windows Communication Foundation service in the background.

Check it out: https://code.msdn.microsoft.com/whiteboard