Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help me insert a table of data into a body of an email


Hi

I have a table example

ID First Name Last Name
1 Bob Smith
2 Tom Black
3 John Turner

in a workbook how do I get this table into a body on an email

Ihave the following which goes into a body however i would like it to
be in a table format with borders etc.


Code:
--------------------
Sub TestFile()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strbody As String

Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup

For Each cell In ThisWorkbook.Sheets("mail").Range("h6:h14")
strbody = strbody & cell.Value & vbNewLine
Next
For Each cell In Sheets("mail").Columns("b").Cells.SpecialCells(xlC ellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = cell.Value
.Subject = Sheets("mail").Range("h1").Value
.Body = "Hello " & cell.Offset(0, -1).Value & vbNewLine & vbNewLine & strbody
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.send 'Or use send
End With
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub

--------------------


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=555487

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help me insert a table of data into a body of an email


I wonder if Ron can help as it is part of his code which I find to be
very usefull


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=555487

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink in body of VBA email Chadersmith Excel Discussion (Misc queries) 1 September 17th 09 07:46 PM
Email Workseet as Body of email [email protected] Excel Programming 11 December 22nd 05 09:43 PM
Email body with a script and a table Who I Am Excel Programming 1 October 15th 05 02:35 AM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 10:55 PM
When sending file via email, cannot paste Excel data into body of letter. Pierre Excel Discussion (Misc queries) 2 February 23rd 05 09:27 PM


All times are GMT +1. The time now is 10:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"