adding attachement to e-mail from Excel

R

Richard

Hello
I would like to automatically send a spreadsheet out via e-
mail, but i do not know how to send it, or even a
selection of the sheet (ie a range of cells). The code i
am using at the moment is as follows. What do i need to
put into the body statement to send either the whole sheet
or some of the cells?

Thanks in advance

Richard

Dim myOutlook As Object
Dim myMailItem As Object
' Make instance
Set myOutlook = CreateObject("Outlook.Application")
' Make mail item
Set myMailItem = myOutlook.CreateItem(0)
' Set recipient (internal mail)
' Set recipient (external mail)
myMailItem.Recipients.Add "(e-mail address removed)"
' Set subject
myMailItem.Subject = "Subcontractor Sheet"
' Set body
myMailItem.Body = Range("A1:Z100")
' And send it!
myMailItem.Send
' Close instance
Set myOutlook = Nothing
 
B

Bob Phillips

Richard,

You can do one of two things.

Either create a new workbook from that sheet, save the workbook, and then
send that saved file as an attachment.

Or send a range of data as HTML text. I believe Ron has some code on his
site that Frank pointed you at.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top