Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Sending Mail from Excel: Body Text

Hello ~

I am mailing a workbook and would like to have the email
body included in the code. Here is what I have currently
(from Ron de Bruin's excellent resource) and it is working
fine for Recepient (I am adding from Outlook address book)
and Subject.


Sub mcrMail_workbook()
'
' mcrMail_workbook()
' Macro recorded 12/1/2003 by
'

'
ActiveWorkbook.SendMail "", _
"Your 2004 Flexible Benefit
Election Form"
End Sub

Does anyone know how to add the body to the code? Ron
also has this but it is not working for me.

Sub Mail_workbook_Outlook()
'This example send the last saved version of the
Activeworkbook
'You must add a reference to the Microsoft outlook Library
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 = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'In Excel 97 use ActiveWorkbook.Path & "\" &
ActiveWorkbook.Name
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Sending Mail from Excel: Body Text

With OE it is not possible to add body text and add a attachment Kathryn.

If you only want to add text to your mail ( Check out the OE part)
http://www.rondebruin.nl/sendmail.htm#body

Maybe CDO is a option for you to do what you want
http://www.rondebruin.nl/cdo.htm

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Kathryn" wrote in message ...
Hello ~

I am mailing a workbook and would like to have the email
body included in the code. Here is what I have currently
(from Ron de Bruin's excellent resource) and it is working
fine for Recepient (I am adding from Outlook address book)
and Subject.


Sub mcrMail_workbook()
'
' mcrMail_workbook()
' Macro recorded 12/1/2003 by
'

'
ActiveWorkbook.SendMail "", _
"Your 2004 Flexible Benefit
Election Form"
End Sub

Does anyone know how to add the body to the code? Ron
also has this but it is not working for me.

Sub Mail_workbook_Outlook()
'This example send the last saved version of the
Activeworkbook
'You must add a reference to the Microsoft outlook Library
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 = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'In Excel 97 use ActiveWorkbook.Path & "\" &
ActiveWorkbook.Name
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Thank you!



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Sending Mail from Excel: Body Text

Ron,

Thanks for your reply. I am such a newbie that I don't
know what OE and CDO. ANyway, I tried the CDO option and
it is not working. Maybe I need to ditch it and just have
it send with a subject.

Another option may be to use an OUtlook template. I have
seen this done before where the attachment inserts itself
into the template. In the instance I am refering to, the
excel workbook was being generated out of Access and the
email address and all the data specific to that recepient
were housed and queried there.

Any thoughts?

Thanks again!
kathryn
-----Original Message-----
With OE it is not possible to add body text and add a

attachment Kathryn.

If you only want to add text to your mail ( Check out the

OE part)
http://www.rondebruin.nl/sendmail.htm#body

Maybe CDO is a option for you to do what you want
http://www.rondebruin.nl/cdo.htm

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Kathryn" wrote in

message ...
Hello ~

I am mailing a workbook and would like to have the email
body included in the code. Here is what I have

currently
(from Ron de Bruin's excellent resource) and it is

working
fine for Recepient (I am adding from Outlook address

book)
and Subject.


Sub mcrMail_workbook()
'
' mcrMail_workbook()
' Macro recorded 12/1/2003 by
'

'
ActiveWorkbook.SendMail "", _
"Your 2004 Flexible Benefit
Election Form"
End Sub

Does anyone know how to add the body to the code? Ron
also has this but it is not working for me.

Sub Mail_workbook_Outlook()
'This example send the last saved version of the
Activeworkbook
'You must add a reference to the Microsoft outlook

Library
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 = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'In Excel 97 use ActiveWorkbook.Path & "\" &
ActiveWorkbook.Name
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Thank you!



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Sending Mail from Excel: Body Text

I was thinking that you are using OE (Outlook Express)
I think I was wrong

If you use Outlook do you set a reference to Outlook?
when you try the outlook macro from my website.

1) Go to the VBA editor, Alt -F11
2) ToolsReferences in the Menu bar
3) Place a Checkmark before Microsoft Outlook ? Object Library
? is the Excel version number

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



wrote in message ...
Ron,

Thanks for your reply. I am such a newbie that I don't
know what OE and CDO. ANyway, I tried the CDO option and
it is not working. Maybe I need to ditch it and just have
it send with a subject.

Another option may be to use an OUtlook template. I have
seen this done before where the attachment inserts itself
into the template. In the instance I am refering to, the
excel workbook was being generated out of Access and the
email address and all the data specific to that recepient
were housed and queried there.

Any thoughts?

Thanks again!
kathryn
-----Original Message-----
With OE it is not possible to add body text and add a

attachment Kathryn.

If you only want to add text to your mail ( Check out the

OE part)
http://www.rondebruin.nl/sendmail.htm#body

Maybe CDO is a option for you to do what you want
http://www.rondebruin.nl/cdo.htm

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Kathryn" wrote in

message ...
Hello ~

I am mailing a workbook and would like to have the email
body included in the code. Here is what I have

currently
(from Ron de Bruin's excellent resource) and it is

working
fine for Recepient (I am adding from Outlook address

book)
and Subject.


Sub mcrMail_workbook()
'
' mcrMail_workbook()
' Macro recorded 12/1/2003 by
'

'
ActiveWorkbook.SendMail "", _
"Your 2004 Flexible Benefit
Election Form"
End Sub

Does anyone know how to add the body to the code? Ron
also has this but it is not working for me.

Sub Mail_workbook_Outlook()
'This example send the last saved version of the
Activeworkbook
'You must add a reference to the Microsoft outlook

Library
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 = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'In Excel 97 use ActiveWorkbook.Path & "\" &
ActiveWorkbook.Name
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub

Thank you!



.



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
Sending a Mail from outlook with body coming from excel file PauloD Excel Discussion (Misc queries) 1 November 11th 10 01:59 PM
sending mails from excel...but mail body disappearing Jithu Excel Discussion (Misc queries) 1 January 10th 08 01:03 PM
EXCEL FORMAT PROBLEM WHEN SENDING EXCEL SHEET AS MESSAGE BODY IN . P.S.Sodha Excel Discussion (Misc queries) 0 April 2nd 05 01:53 PM
Excel 2003 / Send To / Mail Recipient / body text is removed jmaynard2 Excel Discussion (Misc queries) 1 March 16th 05 02:26 AM
When sending file via email, cannot paste Excel data into body of letter. Pierre Excel Discussion (Misc queries) 2 February 23rd 05 09:27 PM


All times are GMT +1. The time now is 08:03 AM.

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"