
Email Data from Excel through Email.
I'd probably do this with a named range in the worksheet and format the
message as HTML so you get a nice table, something like this (code hasn't
been tested -- your mileage may vary).
Set objRange = ActiveWorksheet.Range("TimelinessData")
intRowCount = objRange.Rows.Count
intColCount = objRange.Columns.Count
If intRowCount > 0 and intColCount > 0 Then
Set objApp = CreateObject("Outlook.Application")
Set objMsg = objApp.CreateItem(olMailItem)
strBody = "<table>"
For I = 1 To intRowCount
strBody = strBody & "<tr>"
For J = 1 to intColCount
strBody = strBody & "<td>" & _
objRange.Cells(I, 3) & "</td>"
Next
strBody = strBody & "</tr>"
Next
strBody = strBody & "</table>
objMsg.HTMLBody = strBody
objMsg.Subject = "Timeliness Data"
objMsg.Send
End If
Add formatting tags and attributes to each row or column entry if you like.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming - coming Fall 2002
http://www.slipstick.com/books/jumpstart.htm
Quote:
> Is there away to put data thats on a spreadsheet on an
> email and have it send "On" an email, not as a spreadsheet.
> So what i have is a spreadsheet with a lot of orders and
> order completion times. I have this data Autofiltered by
> column K.
> So Basically what i need some code that will go to A4,
> Select the Current Region and Copy it, and send just that
> information in an email, and the subject line would read
> something like "Timeliness Data"
> Is this Possible?
> Thanks,
> Nick