Border/table in Email .Body

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,228
Office Version
  1. 2010
Platform
  1. Windows
Hi good afternoon please can you help me with the code below, i am trying to put a border/table around the body of the listbox that gets added into the email if you can help please? this is the code i have below.
VBA Code:
Private Sub CommandButton11_Click()
    Dim OutApp As Object
    Dim OutMail As Object

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    With OutMail
     
    .To = "test@gmail.com"
    .subject = "Chaser"
    .Body = Me.ListBox2.Column(1) & ", " & Me.ListBox2.Column(2) & ", " & Me.ListBox2.Column(3) & ", " & Me.ListBox2.Column(4) & ", " & Me.ListBox2.Column(5)
    .Display
  End With
 
  Set OutMail = Nothing
  Set OutApp = Nothing
 
End Sub
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
You need to use .HtmlBody, not Body, and include html code that builds your table and places your referenced values within the table cells. If you don't know how to write html for a table, research that at W3 schools. As for wrapping a border around the email content, I don't know what that means or if it's possible.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,200
Messages
6,123,611
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top