A member of the dope very kindly gave me the following code to reply to a plain-text email in html. Unfortunately I forget who it was. But I’ve already thanked them
Anyway. This code does a ‘reply’ email. In other words it replies to the first person in the ‘from’ field.
Option Explicit
Public Sub ReplyToPlainTextWithHTML()
Dim HTMLReplyMail As Outlook.MailItem
If Application.ActiveExplorer.Selection.Count Then
If TypeOf Application.ActiveExplorer.Selection(1) Is Outlook.MailItem Then
Set HTMLReplyMail = Application.CreateItem(olMailItem)
HTMLReplyMail.To = Application.ActiveExplorer.Selection(1).SenderEmailAddress
HTMLReplyMail.BodyFormat = olFormatHTML
HTMLReplyMail.Subject = "Re: " & Application.ActiveExplorer.Selection(1).Subject
Dim SigString As String
SigString = "C:\Documents and Settings\" & Environ("username") & _
"\Application Data\Microsoft\Signatures\compact.htm"
Dim mailSig As String
If Dir(SigString) <> "" Then
mailSig = GetBoiler(SigString)
Else
mailSig = ""
End If
HTMLReplyMail.HTMLBody = "<br><br>" & mailSig & "<br>" & _
"-----Original Message-----" & "<br>" & _
"From: " & Application.ActiveExplorer.Selection(1).SenderName & "<br>" & _
"Sent: " & Application.ActiveExplorer.Selection(1).SentOn & "<br>" & _
"To: " & Application.ActiveExplorer.Selection(1).To & "<br>" & _
"cc: " & Application.ActiveExplorer.Selection(1).CC & "<br>" & _
"Subject: " & Application.ActiveExplorer.Selection(1).Subject & "<br>" & _
Application.ActiveExplorer.Selection(1).HTMLBody
HTMLReplyMail.Display
End If
End If
End Sub
Function GetBoiler(ByVal sFile As String) As String
'Dick Kusleika
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
So my question is, how would I go about changing this code so that it does ‘reply to all’ instead of just ‘reply’?