tromba
09-16-2012, 12:43 PM
Hi guys, I do have a problem, because I need to fill a table in e-mail message with data from two columns. I know how to create an e-mail, how to create a table, but I have no clue how to fill it with data from spreadsheet.
I'd appreciate any kind of help/tips/or examples, how to solve this.
Thank in advance!
Below is the code I've developed.
Sub CreateBody()
Dim App As Object
Dim item As Object
On Error GoTo ende
esubject = "People on holiday"
sendto = ""
ccto = " "
ebody = "<HTMl><BODY><table border=""1""><tr><td>Person on holiday</td><td>Days on holiday</td></tr><tr><td>John </td><td>12 </td></tr></table></BODY></HTMl>"
Set App = CreateObject("Outlook.Application")
Set itm = App.CreateItem(olMailItem)
With itm
.Subject = esubject
.to = sendto
.cc = ccto
.HTMLBody = ebody
.Display
End With
Set App = Nothing
Set itm = Nothing
ende:
End Sub
I'd appreciate any kind of help/tips/or examples, how to solve this.
Thank in advance!
Below is the code I've developed.
Sub CreateBody()
Dim App As Object
Dim item As Object
On Error GoTo ende
esubject = "People on holiday"
sendto = ""
ccto = " "
ebody = "<HTMl><BODY><table border=""1""><tr><td>Person on holiday</td><td>Days on holiday</td></tr><tr><td>John </td><td>12 </td></tr></table></BODY></HTMl>"
Set App = CreateObject("Outlook.Application")
Set itm = App.CreateItem(olMailItem)
With itm
.Subject = esubject
.to = sendto
.cc = ccto
.HTMLBody = ebody
.Display
End With
Set App = Nothing
Set itm = Nothing
ende:
End Sub