ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to send email from excel (https://www.excelbanter.com/excel-programming/377399-how-send-email-excel.html)

Mistry

How to send email from excel
 
Hi All

I have the following bit of code which will send the excel workbook as
an attachment. I have it enter in the subject and set the flag for
read recipt to true but how do i enter some text into the main message
body.

Application.EnableAnimations = False
Application.ScreenUpdating = False
Range("D6").Select
Userid = ActiveCell.FormulaR1C1
Range("C28").Select
Addressee = ActiveCell.FormulaR1C1
Subject = "CC:PY:INFO03: " + Userid
ActiveWorkbook.Title = Subject
ActiveWorkbook.Subject = "EPG"
Application.EnableAnimations = True
Application.ScreenUpdating = True
ActiveWorkbook.SendMail Addressee, Subject, True
MsgBox "This form has been sent to Desk Europe. A copy is stored in
your Outlook Sent Folder."
On Error GoTo 0
End Sub


Any ideas?


[email protected]

How to send email from excel
 

Goto Ron's site who is the master for eMailing from Excel

http://www.rondebruin.nl

Mistry wrote:
Hi All

I have the following bit of code which will send the excel workbook as
an attachment. I have it enter in the subject and set the flag for
read recipt to true but how do i enter some text into the main message
body.

Application.EnableAnimations = False
Application.ScreenUpdating = False
Range("D6").Select
Userid = ActiveCell.FormulaR1C1
Range("C28").Select
Addressee = ActiveCell.FormulaR1C1
Subject = "CC:PY:INFO03: " + Userid
ActiveWorkbook.Title = Subject
ActiveWorkbook.Subject = "EPG"
Application.EnableAnimations = True
Application.ScreenUpdating = True
ActiveWorkbook.SendMail Addressee, Subject, True
MsgBox "This form has been sent to Desk Europe. A copy is stored in
your Outlook Sent Folder."
On Error GoTo 0
End Sub


Any ideas?



[email protected]

How to send email from excel
 
Below is a snippet of code I use to insert text and a range in to the
body of an email using Outlook. "Rangetohtml" is a routine that picks
up the inserted range.

Hope this helps.

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.FormDescription.OneOff = True
'.FormDescription.Locked = True
End With
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = Range("Vouch_Code") & " Voucher Approval Request -
Acct " & _
Application.Text(Range("Acct_1"), "####-###-####") & " - "
& _
Application.Text(Range("Voucher_Amount"), "$#,###.00") & "
- " & _
Application.Text(Right(Range("'Voucher
Form.xls'!Prepared_by"), 6), "00####")
.HTMLBody = "<br" & "Approvers see notes at bottom." &
"<br<br" & _
RangetoHTML & "<br<br<br<br" &
Application.Text(Range("Acct_1"), "###########") & _
"<br<br" & Application.Text(Range("Acct_2"), "###########") &
"<br<br" & _
Mistry wrote:
Hi All

I have the following bit of code which will send the excel workbook as
an attachment. I have it enter in the subject and set the flag for
read recipt to true but how do i enter some text into the main message
body.

Application.EnableAnimations = False
Application.ScreenUpdating = False
Range("D6").Select
Userid = ActiveCell.FormulaR1C1
Range("C28").Select
Addressee = ActiveCell.FormulaR1C1
Subject = "CC:PY:INFO03: " + Userid
ActiveWorkbook.Title = Subject
ActiveWorkbook.Subject = "EPG"
Application.EnableAnimations = True
Application.ScreenUpdating = True
ActiveWorkbook.SendMail Addressee, Subject, True
MsgBox "This form has been sent to Desk Europe. A copy is stored in
your Outlook Sent Folder."
On Error GoTo 0
End Sub


Any ideas?



Mistry

How to send email from excel
 
Cheers all worked a treat.

M



All times are GMT +1. The time now is 11:17 AM.

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