title: VBA Sending formatted email with CDO
body: <p>I have this code, that works. </p>
  
  <pre><code>  Private Sub CommandButton1_Click()
    Dim Mail As New Message
    Dim Config As Configuration
    Set Config = Mail.Configuration
    Dim cell As Range
    Dim strbody As String
    For Each cell In Sheets("Sheet1").Range("C2:D9")
        strbody = strbody &amp; cell.Value &amp; vbNewLine
    Next
  
    Config(cdoSendUsingMethod) = cdoSendUsingPort
    Config(cdoSMTPServer) = "smtp.gmail.com"
    Config(cdoSMTPServerPort) = 25
    Config(cdoSMTPAuthenticate) = cdoBasic
    Config(cdoSMTPUseSSL) = True
    Config(cdoSendUserName) = "MyEmail"
    Config(cdoSendPassword) = "EmailPassword"
    Config.Fields.Update
  
    Mail.To = Sheets("Sheet1").Range("j2").Value
    Mail.From = Config(cdoSendUserName)
    Mail.Subject = "Email Subject"
    Mail.TextBody = strbody
  
    If G9 = "Yes" Then
    Mail.AddAttachment "C:\...file1.xls"
    Mail.AddAttachment "C:\...file2.xls"
    End If
  
    On Error Resume Next
  
    Mail.Send
  
    If Err.Number &lt;&gt; 0 Then
      MsgBox Err.Description, vbCritical, "There was an error"
      Exit Sub
    End If
    MsgBox "Your email has been send!", vbInformation, "Sent"
  
  End Sub
  </code></pre>
  
  <p>It will take the text I have in C2:D9 but it does not format it as it is in the sheet, so it looks like this when sent: 
  Item1<br />
  Result1<br />
  Item2<br />
  Result2<br />
  Item3<br />
  Result3<br />
  Item4<br />
  Result4</p>
  
  <p>If I set the Mail.TextBody to Mail.HTMLBody, it comes out like this:</p>
  
  <p>Item1 Result1 Item2 Result2 Item3 Result3 Item4 Result4 </p>
  
  <p>How can I make it send exactly what is in those ranges as it is formatted in the excel sheet? 
  If I were to manually copy those cells and paste them into an email body, it would keep the cell structure, font size, font color, and any background colors as well. </p>
  
  <p>Item1     Result1<br />
  Item2     Result2<br />
  Item3     Result3<br />
  Item4     Result4</p>
  
  <p>I have been looking online a lot to try and find this but have not been able to for CDO. I found some items for Outlook but I am not using Outlook.</p>
  
  <p>Is it possible to send a formatted block of cells using the CDO email method of sending an email? </p>
  
  <p>Thank you.</p>