I'm not heavy into Outlook addins but it seems to me that you don't really need to use the code that is blowing up. Starting on the line Set Msg =
you're getting the active mail item. Note that this could be nothing potentially so you should handle that case. But given that mail item you already have access to the body of the message so you can set it.
Just guessing at what the code might look like here.
Sub standardResponse()
Dim Msg As Outlook.MailItem
If (Not ActiveExplorer Is Nothing) AndAlso (Not ActiveExplorer.Selection Is Nothing) AndAlso (ActiveExplorer.Selection.Count > 0) Then
Set Msg = ActiveExplorer.Selection.Item(1)
End If
If (Msg Is Nothing) Then
Return
End If
Dim ReplyName As String
If InStr(1, Msg.SenderName, ",") Then
ReplyName = Right$(Msg.SenderName, Len(Msg.SenderName) - InStr(1, Msg.SenderName, ","))
Else
ReplyName = Left$(Msg.SenderName, InStr(1, Msg.SenderName, " ") - 1)
End If
Msg.Body = "Hi " & ReplyName & "," & vbCrLf & "This is done"
End Sub