LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy and paste 2 excel sheets in message body of email

Hello all. I am using the following code in an excel workbook (it is
automated to email itself as an attachment) that copies and pastes
Sheet1 into the body of an email:

Public Function SheetToHTML(SH As Worksheet)
'Function from Dick Kusleika his site
'http://www.dicks-clicks.com/excel/sheettohtml.htm
'Changed by Ron de Bruin 04-Nov-2003
Dim TempFile As String
Dim Nwb As Workbook
Dim myshape As Shape
Dim fso As Object
Dim ts As Object
SH.Copy
Set Nwb = ActiveWorkbook
For Each myshape In Nwb.Sheets(1).Shapes
myshape.Delete
Next
TempFile = Environ$("temp") & "/" & _
Format(Now, "dd-mm-yy h-mm-ss") & ".htm"
Nwb.SaveAs TempFile, xlHtml
Nwb.Close False
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
SheetToHTML = ts.ReadAll
ts.Close
Set ts = Nothing
Set fso = Nothing
Set Nwb = Nothing
Kill TempFile
End Function

I am a rookie with VBA. How can I get this code to copy both Sheet1
and Sheet2 into the body of the email? Any ideas/suggestions will be
greatly appreciated. Have a nice day.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
email excel spreadsheet as body of message, not as attachment Email Spreadsheet as Body of Email Msg. Excel Discussion (Misc queries) 5 June 12th 06 03:23 PM
Body message - email al007 Excel Programming 2 January 24th 06 11:08 AM
Copy and Paste from Excel into Outlook Email message TroyB[_2_] Excel Programming 0 November 10th 04 08:01 AM
How to paste cells from Excel into Outlook email body? stastim Excel Programming 2 August 23rd 04 06:35 PM
Copy and Paste a Worksheet Range to Email Body Eric[_14_] Excel Programming 1 January 20th 04 12:06 AM


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"