Let's start again with the whole macro and remove some of the superfluous code:
Option Explicit
Sub ForceReplyInHTML()
'=================================================================
'Description: Outlook macro to reply to a message in HTML
' regardless of the current message format.
' The reply will use your HTML signature as well.
'
'author : Robert Sparnaaij modified by Graham Mayor
'version: 1.1
'=================================================================
Dim objOL As Outlook.Application
Dim objSelection As Outlook.Selection
Dim objItem As Object
'Dim olMsg As Outlook.MailItem
Dim olMsgReply As Outlook.MailItem
Dim IsPlainText As Boolean
Set objOL = Outlook.Application
'Get the selected item
Select Case TypeName(objOL.ActiveWindow)
Case "Explorer"
Set objSelection = objOL.ActiveExplorer.Selection
If objSelection.Count > 0 Then
Set objItem = objSelection.Item(1)
Else
MsgBox "No item selected. " & _
"Please make a selection first.", _
vbCritical, "Reply in HTML"
Exit Sub
End If
Case "Inspector"
Set objItem = objOL.ActiveInspector.CurrentItem
Case Else
MsgBox "Unsupported Window type." & _
vbNewLine & "Please make a selection" & _
" or open an item first.", _
vbCritical, "Reply in HTML"
Exit Sub
End Select
'Change the message format and reply
If objItem.Class = olMail Then
'Set olMsg = objItem
If objItem.BodyFormat = olFormatPlain Then
IsPlainText = True
End If
objItem.BodyFormat = olFormatHTML
Set olMsgReply = objItem.Reply
If IsPlainText = True Then
objItem.BodyFormat = olFormatPlain
End If
objItem.Close 1
olMsgReply.BodyFormat = olFormatHTML
olMsgReply.Display
olMsgReply.HTMLBody = "Any Reply?" & olMsgReply.HTMLBody
'Selected item isn't a mail item
Else
MsgBox "No message item selected. " & _
"Please make a selection first.", _
vbCritical, "Reply in HTML"
End If
'Cleanup
Set objOL = Nothing
Set objItem = Nothing
Set objSelection = Nothing
'Set olMsg = Nothing
Set olMsgReply = Nothing
End Sub