Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Turning Spreadsheet into attachement in an Email


Can someone possibly help. I have written the following macro to send an
excel spreadsheet as an attachment. It all seems to work well except,
for some reason, it does not put the text "Please find attached" that I
want in the body of the email. It only adds the attachment and the
subject title.

Can someone tell me where I am going wrong?



Sub Mail_workbook_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
..To = "
..CC = "
..BCC = ""
..Subject = "Text"
Dim strbody As String
strbody = "Please find attached" & vbNewLine & vbNewLine & _
"Kind regards" & vbNewLine & _
"Me"
..Attachments.Add
("L:\somewhere\somewhere\somewhere\spreadsheet.xls ")
..Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--
twogoodtwo
------------------------------------------------------------------------
twogoodtwo's Profile: http://www.excelforum.com/member.php...o&userid=12738
View this thread: http://www.excelforum.com/showthread...hreadid=346026

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Turning Spreadsheet into attachement in an Email

Sub Mail_workbook_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
..To = "
..CC = "
..BCC = ""
..Subject = "Text"
Dim strbody As String
strbody = "Please find attached" & vbNewLine & vbNewLine & _
"Kind regards" & vbNewLine & _
"Me"
..Body = strbody
..Attachments.Add ("L:\somewhere\somewhere\somewhere\spreadsheet.xls ")
..Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"twogoodtwo" wrote in message
...

Can someone possibly help. I have written the following macro to send an
excel spreadsheet as an attachment. It all seems to work well except,
for some reason, it does not put the text "Please find attached" that I
want in the body of the email. It only adds the attachment and the
subject title.

Can someone tell me where I am going wrong?



Sub Mail_workbook_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
To = "
CC = "
BCC = ""
Subject = "Text"
Dim strbody As String
strbody = "Please find attached" & vbNewLine & vbNewLine & _
"Kind regards" & vbNewLine & _
"Me"
Attachments.Add
("L:\somewhere\somewhere\somewhere\spreadsheet.xls ")
Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--
twogoodtwo
------------------------------------------------------------------------
twogoodtwo's Profile:

http://www.excelforum.com/member.php...o&userid=12738
View this thread: http://www.excelforum.com/showthread...hreadid=346026





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Turning Spreadsheet into attachement in an Email

Try:

Sub Mail_workbook_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "
.CC = "
.BCC = ""
.Subject = "Text"
.Body = "Please find attached" & _
vbNewLine & vbNewLine & _
"Kind regards" & _
vbNewLine & vbNewLine & _
"Me"
.Attachments.Add _
"L:\somewhere\somewhere\somewhere\spreadsheet. xls"
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Regards

Trevor


"twogoodtwo" wrote in message
...

Can someone possibly help. I have written the following macro to send an
excel spreadsheet as an attachment. It all seems to work well except,
for some reason, it does not put the text "Please find attached" that I
want in the body of the email. It only adds the attachment and the
subject title.

Can someone tell me where I am going wrong?



Sub Mail_workbook_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
To = "
CC = "
BCC = ""
Subject = "Text"
Dim strbody As String
strbody = "Please find attached" & vbNewLine & vbNewLine & _
"Kind regards" & vbNewLine & _
"Me"
Attachments.Add
("L:\somewhere\somewhere\somewhere\spreadsheet.xls ")
Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--
twogoodtwo
------------------------------------------------------------------------
twogoodtwo's Profile:
http://www.excelforum.com/member.php...o&userid=12738
View this thread: http://www.excelforum.com/showthread...hreadid=346026



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Turning Spreadsheet into attachement in an Email

Hi,

How about something like the following: (you've assigned the variable but
haven't assigned it to the "Body" property)

Best regards

John

UNTESTED...

Sub Mail_workbook_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Dim strbody As String
strbody = "Please find attached" & vbNewLine & vbNewLine & _
"Kind regards" & vbNewLine & _
"Me"
With OutMail
.To = "
.CC = "
.BCC = ""
.Subject = "Text"
.Body = strbody
.Attachments.Add ("L:\somewhere\somewhere\somewhere\spreadsheet.xls ")
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


"twogoodtwo" wrote in message
...

Can someone possibly help. I have written the following macro to send an
excel spreadsheet as an attachment. It all seems to work well except,
for some reason, it does not put the text "Please find attached" that I
want in the body of the email. It only adds the attachment and the
subject title.

Can someone tell me where I am going wrong?



Sub Mail_workbook_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
To = "
CC = "
BCC = ""
Subject = "Text"
Dim strbody As String
strbody = "Please find attached" & vbNewLine & vbNewLine & _
"Kind regards" & vbNewLine & _
"Me"
Attachments.Add
("L:\somewhere\somewhere\somewhere\spreadsheet.xls ")
Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub


--
twogoodtwo
------------------------------------------------------------------------
twogoodtwo's Profile:
http://www.excelforum.com/member.php...o&userid=12738
View this thread: http://www.excelforum.com/showthread...hreadid=346026



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
Email excel spreadsheet - embedded in email Lisa Excel Discussion (Misc queries) 6 September 25th 08 04:17 PM
Sending a Spreadsheet as an Email Attachment vs. Imbedded in Email billbrandi Excel Discussion (Misc queries) 1 April 3rd 08 03:44 AM
Spreadsheet as an attachement jerri New Users to Excel 2 September 24th 07 12:30 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM
Turning a notepad document into an excel spreadsheet lbierer Setting up and Configuration of Excel 1 April 21st 05 01:40 PM


All times are GMT +1. The time now is 02:07 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"