Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default adding attachement to e-mail from Excel

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 "
' Set subject
myMailItem.Subject = "Subcontractor Sheet"
' Set body
myMailItem.Body = Range("A1:Z100")
' And send it!
myMailItem.Send
' Close instance
Set myOutlook = Nothing
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default adding attachement to e-mail from Excel

Hi
have a look at
http://www.rondebruin.nl/sendmail.htm

--
Regards
Frank Kabel
Frankfurt, Germany


Richard wrote:
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 "
' Set subject
myMailItem.Subject = "Subcontractor Sheet"
' Set body
myMailItem.Body = Range("A1:Z100")
' And send it!
myMailItem.Send
' Close instance
Set myOutlook = Nothing

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default adding attachement to e-mail from Excel

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)

"Richard" wrote in message
...
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 "
' Set subject
myMailItem.Subject = "Subcontractor Sheet"
' Set body
myMailItem.Body = Range("A1:Z100")
' And send it!
myMailItem.Send
' Close instance
Set myOutlook = Nothing



Reply
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
Spreadsheet as an attachement jerri New Users to Excel 2 September 24th 07 12:30 PM
How come Word is adding zeros to a mail merge number from Excel? Randy Toch Excel Worksheet Functions 1 May 24th 06 05:50 AM
Send to mail recipient (as attachement) is greyed out Phan Excel Discussion (Misc queries) 2 May 18th 05 03:26 PM
Send as attachement Scott McDonald Excel Discussion (Misc queries) 0 April 25th 05 06:13 PM
how to send a workbook shortcut as attachement in an e-mail from a userform Valeria[_2_] Excel Programming 5 January 22nd 04 12:02 PM


All times are GMT +1. The time now is 10:31 AM.

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"