ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   email multiple worksheets (https://www.excelbanter.com/excel-programming/427388-email-multiple-worksheets.html)

Jeff

email multiple worksheets
 
I am using Ron de Bruin Outlook object model (body)
http://www.rondebruin.nl/sendmail.htm This works very well thanks!Ron
I would like to add a second sheet to the bottom of the emil (sheet1). How
would you add a second sheet to the bottom of the body of the email?
Thanks! Jeff


Ron de Bruin

email multiple worksheets
 
Hi Jeff

Use it like this.
This example add sheet1 and sheet2 in the body of the mail

Sub Mail_Sheet_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007
Dim rng As Range
Dim rng2 As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set rng = Nothing
Set rng2 = Nothing
Set rng = Sheets("Sheet1").UsedRange
Set rng2 = Sheets("Sheet2").UsedRange

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng) & "<br<br" & RangetoHTML(rng2)
.display 'or use .Send
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Jeff" wrote in message ...
I am using Ron de Bruin Outlook object model (body)
http://www.rondebruin.nl/sendmail.htm This works very well thanks!Ron
I would like to add a second sheet to the bottom of the emil (sheet1). How
would you add a second sheet to the bottom of the body of the email?
Thanks! Jeff


Jeff

email multiple worksheets
 
That is what I was looking for. Thanks again Ron!
Jeff

"Ron de Bruin" wrote:

Hi Jeff

Use it like this.
This example add sheet1 and sheet2 in the body of the mail

Sub Mail_Sheet_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007
Dim rng As Range
Dim rng2 As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set rng = Nothing
Set rng2 = Nothing
Set rng = Sheets("Sheet1").UsedRange
Set rng2 = Sheets("Sheet2").UsedRange

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng) & "<br<br" & RangetoHTML(rng2)
.display 'or use .Send
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Jeff" wrote in message ...
I am using Ron de Bruin Outlook object model (body)
http://www.rondebruin.nl/sendmail.htm This works very well thanks!Ron
I would like to add a second sheet to the bottom of the emil (sheet1). How
would you add a second sheet to the bottom of the body of the email?
Thanks! Jeff



Ron de Bruin

email multiple worksheets
 
You are welcome

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Jeff" wrote in message ...
That is what I was looking for. Thanks again Ron!
Jeff

"Ron de Bruin" wrote:

Hi Jeff

Use it like this.
This example add sheet1 and sheet2 in the body of the mail

Sub Mail_Sheet_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007
Dim rng As Range
Dim rng2 As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set rng = Nothing
Set rng2 = Nothing
Set rng = Sheets("Sheet1").UsedRange
Set rng2 = Sheets("Sheet2").UsedRange

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng) & "<br<br" & RangetoHTML(rng2)
.display 'or use .Send
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Jeff" wrote in message ...
I am using Ron de Bruin Outlook object model (body)
http://www.rondebruin.nl/sendmail.htm This works very well thanks!Ron
I would like to add a second sheet to the bottom of the emil (sheet1). How
would you add a second sheet to the bottom of the body of the email?
Thanks! Jeff




All times are GMT +1. The time now is 07:19 AM.

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