ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Mail Sheet as message body (https://www.excelbanter.com/excel-programming/316745-mail-sheet-message-body.html)

AR

Mail Sheet as message body
 
Hi
I have used the following code for sending a mail from excel, this code
attach the active work book in the mail.
Im trying to send the worksheet as as message body of the mail

I've tried ".BodyHTML = SheetToHTMl(Activesheet) "

' Sub mail_with_outlook()

Dim Outapp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strto As String

Set Outapp = CreateObject("Outlook.application")
Set OutMail = Outapp.CreateItem(olMailItem)
strto = "
strsub = Sheets("Sheet1").Range("B11").Value
ActiveWorkbook.Save
With OutMail
.To = strto
.CC = strcc
.Subject = strsub
.Attachments.Add ActiveWorkbook.FullName

On Error Resume Next
..Send
End With

End Sub

but could not get the result, an any one help

Ron de Bruin

Mail Sheet as message body
 
Hi Ar

Look here for a example
http://www.rondebruin.nl/mail/folder3/mail2.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"AR" wrote in message ...
Hi
I have used the following code for sending a mail from excel, this code
attach the active work book in the mail.
Im trying to send the worksheet as as message body of the mail

I've tried ".BodyHTML = SheetToHTMl(Activesheet) "

' Sub mail_with_outlook()

Dim Outapp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strto As String

Set Outapp = CreateObject("Outlook.application")
Set OutMail = Outapp.CreateItem(olMailItem)
strto = "
strsub = Sheets("Sheet1").Range("B11").Value
ActiveWorkbook.Save
With OutMail
.To = strto
.CC = strcc
.Subject = strsub
.Attachments.Add ActiveWorkbook.FullName

On Error Resume Next
..Send
End With

End Sub

but could not get the result, an any one help





All times are GMT +1. The time now is 05:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com