VBA : Outlook Email formating :: Table

RAKESH230583

New Member
Joined
Jan 10, 2011
Messages
46
Dear All,
I have below sub for creating the email - from data inputted in user form
I would like to know whether it is possible to convert the list of Case details in tabular format instead of list.

Sub Send_Email()
Dim olApp As Outlook.Application
Dim olemail As Outlook.MailItem
Dim emailaddress1, emailaddress2, emailaddress3 As String
Set olApp = New Outlook.Application
Set olemail = olApp.CreateItem(olMailItem)
Set emailaddress1 = Sheets("Email_Addresses").Range("C4")
Set emailaddress2 = Sheets("Email_Addresses").Range("C6")
With olemail
.BodyFormat = olFormatHTML
.Display
- '.HTMLBody = "Dear Team,<br>" & " <br> " & "Please find below detials refering to system issue reported.<br>" & .HTMLBody
- .HTMLBody = "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Dear Team,<br>" & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Please find below incident raised details.<br>" & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Request you to kindly check the same and do the needfull.<br>" & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;""<u><B>Case related Information:</u></B><br>" & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case1:" & Create.TextBox1.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case2:" & Create.TextBox2.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case3:" & Create.TextBox3.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case4:" & Create.TextBox4.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case5:" & Create.TextBox5.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case6:" & Create.TextBox6.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case7:" & Create.TextBox7.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case8:" & Create.ComboBox8.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case9:" & Create.ComboBox9.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case10:" & Create.ComboBox10.Value & "<br>" & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;""<u><B>Other related Information:</u></B><br>" & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case1:" & Create.ComboBox1.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case2:" & Create.ComboBox2.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case3:" & Create.ComboBox3.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case4:" & Create.ComboBox4.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case5:" & Create.ComboBox5.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case6:" & Create.ComboBox6.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case7:" & Create.TextBox8.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case8:" & Create.TextBox9.Value & "<br>" & _
- "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case9:" & Create.TextBox10.Value & "<br>" & "<font face=""Agfa Rotis Semisans Light"" style=""font-size:11pt;"">Case10:" & Create.TextBox11.Value & "<br>" & -.HTMLBody

.To = emailaddress1
.CC = emailaddress2
.Subject = "System Issue" & " " & "::" & _
Create.ComboBox1.Value & " " & "::" & _
Create.ComboBox2.Value & " " & "::" & _
Create.ComboBox6.Value & " " & "::" & _
Create.ComboBox4.Value & " " & "::" & _
Create.TextBox1.Value
End With
End Sub
Unquote
 
Last edited:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
<table style="width: 178pt; border-collapse: collapse;" width="238">
<tbody>
<tr style="height: 15.75pt;">
<td style="border-width: 1pt 0.5pt; border-style: solid; border-color: black; width: 178pt; height: 15px; background-color: black;" colspan="2" width="238"><span style="color: #ffffff;"><strong>Case related Information</strong></span></td>
</tr>
<tr style="height: 15pt;">
<td style="border: 0.5pt solid black; height: 15px; background-color: transparent;">Case 1</td>
<td style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: black; height: 15px; background-color: transparent;">ComboBox1</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 2</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">ComboBox2</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 3</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">ComboBox3</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 4</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">ComboBox4</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 5</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">ComboBox5</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 6</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">ComboBox6</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 7</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">TextBox8</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 8</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">TextBox9</td>
</tr>
<tr style="height: 15pt;">
<td style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 9</td>
<td style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">TextBox10</td>
</tr>
<tr style="height: 15.75pt;">
<td style="border-width: 0px 0.5pt 1pt; border-style: none solid solid; border-color: black; height: 15px; background-color: transparent;">Case 10</td>
<td style="border-width: 0px 0.5pt 1pt 0px; border-style: none solid solid none; border-color: black; height: 15px; background-color: transparent;">TextBox11</td>
</tr>
</tbody>
</table>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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