Bigbeam
12-18-2015, 09:24 AM
Found this macro on the net to force an HTML format reply but does not seem to work - I have it pasted into ThisOutlookSession. I have traced through it and the code is definitely running when I do a reply - however, my email signature is still being inserted as plain text and the reply email is still formatted as plain text. What's going on?
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 Sub
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 Sub