Can anyone help with E-mail macro


Posted by Lewis (1) on December 16, 2001 6:14 AM

Hi

Robb was kind enough to give me the following

Sub SendSheet()
Dim myFile As String, s As String
'Copy the sheet to a new workbook ready to mail
ThisWorkbook.ActiveSheet.Copy
'Identify the new book
myFile = ActiveWorkbook.Name
ThisWorkbook.Activate
'Open mail session if not already open
If Not IsNull(Application.MailSession) Then Application.MailLogon
'Identify the sheet containing the mail addresses
With ThisWorkbook.Worksheets("Sheet1").Cells
'Target the cells containing the addresses
For Each c In .Range("B1:B4").Cells
'Ensure the addresses are read as text
s = c.Value
'Mail the document
Workbooks(myFile).SendMail Recipients:=s, Subject:="Here is the sheet", ReturnReceipt:=True
Next c
End With
'Close the temp file without saving
Workbooks(myFile).Close savechanges:=False
End Sub

This copies the active sheet opens a new workbook and sends the info as an attachment Book1.xls etc.

Can anyone claify if it is necessary to open a new workbook? or can you send the page directly

Is it possible to send the page in the body of the message, with or without opening a new workbook

Regards

Lewis

Posted by Lewis (1) on December 16, 2001 8:42 AM

Also

Is there any way to close the mail session?

Posted by DaK on December 16, 2001 4:34 PM

Re: Also

DaK

Hi



Posted by Caleb on December 16, 2001 5:11 PM

Re: Also

Take a look at...
http://bbs.elementkjournals.com/bbs/showflat.pl?Cat=&Board=excel&Number=67744&page=2&view=collapsed&sb=5&o=0&part=

Note that Excel 2000 does allow you to send an Excel sheet as an Outlook message.

Caleb