Showing posts with label Technical Info. Show all posts
Showing posts with label Technical Info. Show all posts

MS Outlook Plain Text Alignment Error

Something that has driven me wild over the past few weeks is that my instance of MS Outlook insists on aligning all plain text emails to the right. I have searcged in vain for a solution so the best I have been able to come up with for now is the VBA code below that converts all incoming mail to HTML format. Please feel free to use this code if you have the same problem. Simply paste the code into the "ThisOutlookSession" module in your VBA editor

Public WithEvents myOlItems As Outlook.Items

Private Sub Application_Quit()
  Set myOlItems = Nothing
End Sub

Private Sub Application_Startup()
  Set myOlItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
End Sub

' Converts incoming messages from plain text to HTML because they
' seem to right align as plain text.

Private Sub myOlItems_ItemAdd(ByVal Item As Object)
  Dim mi As Outlook.MailItem

  If Item.Class = olMail Then
    Set mi = Item
    If mi.BodyFormat = olFormatPlain Then
      mi.BodyFormat = olFormatHTML
      mi.Save
    End If
  End If
End Sub