#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Attachments

I am trying to send Excel worksheets to mail receipients.
The worksheets are in a workbook. I can get the workbook
to send using this code but I need it to send the
WORKSHEET only. Any ideas, please.

Sub ATest()

Code being used:

Dim xlApp As New Excel.Application, xlItem As
Excel.Sheets
Dim olApp As New Outlook.Application, olItem As
Outlook.MailItem
Dim olAttachments As Outlook.Attachments
Dim strMess As String, strTitle As String, strTo As
String

Set olItem = olApp.CreateItem(olMailItem)
strTo = "
strMess = "New Worksheet Attached"
olItem.Subject = "New Worksheet "
olItem.to = strTo
olItem.Attachments.Add ("P:\MyFolder\activities.xls")
olItem.Body = strMess
olItem.Send
Set olItem = Nothing

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Attachments

copy the sheet to a new workbook with only a single sheet. Send this
workbook. Close this copy without saving. Do this in code, of course.
--
Regards,
Tom Ogilvy

"Gerry" wrote in message
...
I am trying to send Excel worksheets to mail receipients.
The worksheets are in a workbook. I can get the workbook
to send using this code but I need it to send the
WORKSHEET only. Any ideas, please.

Sub ATest()

Code being used:

Dim xlApp As New Excel.Application, xlItem As
Excel.Sheets
Dim olApp As New Outlook.Application, olItem As
Outlook.MailItem
Dim olAttachments As Outlook.Attachments
Dim strMess As String, strTitle As String, strTo As
String

Set olItem = olApp.CreateItem(olMailItem)
strTo = "
strMess = "New Worksheet Attached"
olItem.Subject = "New Worksheet "
olItem.to = strTo
olItem.Attachments.Add ("P:\MyFolder\activities.xls")
olItem.Body = strMess
olItem.Send
Set olItem = Nothing

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Attachments

Hi Gerry

Look for code examples here
http://www.rondebruin.nl/sendmail.htm

You can use one of the the Add-ins also if you want
http://www.rondebruin.nl/mail/add-in.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Gerry" wrote in message ...
I am trying to send Excel worksheets to mail receipients.
The worksheets are in a workbook. I can get the workbook
to send using this code but I need it to send the
WORKSHEET only. Any ideas, please.

Sub ATest()

Code being used:

Dim xlApp As New Excel.Application, xlItem As
Excel.Sheets
Dim olApp As New Outlook.Application, olItem As
Outlook.MailItem
Dim olAttachments As Outlook.Attachments
Dim strMess As String, strTitle As String, strTo As
String

Set olItem = olApp.CreateItem(olMailItem)
strTo = "
strMess = "New Worksheet Attached"
olItem.Subject = "New Worksheet "
olItem.to = strTo
olItem.Attachments.Add ("P:\MyFolder\activities.xls")
olItem.Body = strMess
olItem.Send
Set olItem = Nothing

End Sub



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
attachments - KIRK Setting up and Configuration of Excel 0 September 28th 07 08:01 PM
attachments Paul Excel Discussion (Misc queries) 3 September 5th 07 12:34 PM
Email attachments Holden Caulfield New Users to Excel 1 April 20th 07 02:00 AM
links to attachments [email protected] Links and Linking in Excel 0 September 18th 06 04:51 PM
Attachments meyer99 Excel Worksheet Functions 1 June 22nd 05 10:11 AM


All times are GMT +1. The time now is 02:32 PM.

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

About Us

"It's about Microsoft Excel"