Border/table in Email .Body

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,227
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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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,097
Messages
6,123,076
Members
449,094
Latest member
mystic19

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