Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
aph aph is offline
external usenet poster
 
Posts: 1
Default Adding text to body of email with workbook attached.


Hi

My manager now wants to add text to the body of email being sent by
excel macro with a workbook attached. I have seen on other postings
different method using .Mail rather than .SendMail (see snippet below)
As a newbie not sure of the differences but if I try .Mail it comes u
with 2 security warnings (which ideally I would like to skip). Whic
brings me onto the second part how to implement :-

.Display
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%S"

so the email sends without intervention.

Any help would be appreciated.

Andrew


Sub Email_test()
ActiveSheet.Copy
sheet_name = ActiveSheet.Name
Set wb = ActiveWorkbook
email_contact_address = “Test_Contact@xxx
File_Title = "Test_sheet"
ActiveSheet.Buttons.Delete
ActiveSheet.Range("A1:X35").ClearComments

ActiveWindow.DisplayGridlines = False

Range("X1:BB50").Select
Selection.Clear
Range("A1").Select

ActiveWindow.DisplayGridlines = False
With wb
.SaveAs File_Title
' .Body = "Please note:- " <<<<<<<<<<
.SendMail email_contact_address, _
Email_Title

' .Display <<<<<<<<<<
'Application.Wait (Now + TimeValue("0:00:02")) <<<<<<<<<<
'Application.SendKeys "%S" <<<<<<<<<<
.ChangeFileAccess xlReadOnly
.Close True
End With
Kill Timesheet_Title ' Attempt to delet
open
End Su

--
ap
-----------------------------------------------------------------------
aph's Profile: http://www.excelforum.com/member.php...fo&userid=1717
View this thread: http://www.excelforum.com/showthread.php?threadid=49071

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Adding text to body of email with workbook attached.

Hi

With SendMail this is not possible.
You must use the Outlook Object model if you run Outlook.

See my site for example code
http://www.rondebruin.nl/sendmail.htm


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


"aph" wrote in message ...

Hi

My manager now wants to add text to the body of email being sent by a
excel macro with a workbook attached. I have seen on other postings a
different method using .Mail rather than .SendMail (see snippet below).
As a newbie not sure of the differences but if I try .Mail it comes up
with 2 security warnings (which ideally I would like to skip). Which
brings me onto the second part how to implement :-

Display
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%S"

so the email sends without intervention.

Any help would be appreciated.

Andrew


Sub Email_test()
ActiveSheet.Copy
sheet_name = ActiveSheet.Name
Set wb = ActiveWorkbook
email_contact_address = "Test_Contact@xxx
File_Title = "Test_sheet"
ActiveSheet.Buttons.Delete
ActiveSheet.Range("A1:X35").ClearComments

ActiveWindow.DisplayGridlines = False

Range("X1:BB50").Select
Selection.Clear
Range("A1").Select

ActiveWindow.DisplayGridlines = False
With wb
SaveAs File_Title
' .Body = "Please note:- " <<<<<<<<<<
SendMail email_contact_address, _
Email_Title

' .Display <<<<<<<<<<
'Application.Wait (Now + TimeValue("0:00:02")) <<<<<<<<<<
'Application.SendKeys "%S" <<<<<<<<<<
ChangeFileAccess xlReadOnly
Close True
End With
Kill Timesheet_Title ' Attempt to delete
open
End Sub


--
aph
------------------------------------------------------------------------
aph's Profile: http://www.excelforum.com/member.php...o&userid=17175
View this thread: http://www.excelforum.com/showthread...hreadid=490717



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Adding text to body of email with workbook attached.

Hi
You cannot avoid the warning but you could consider using CDO to send mail,
see the following excellent reference.....

http://www.rondebruin.nl/cdo.htm

--
Cheers
Nigel



"aph" wrote in message
...

Hi

My manager now wants to add text to the body of email being sent by a
excel macro with a workbook attached. I have seen on other postings a
different method using .Mail rather than .SendMail (see snippet below).
As a newbie not sure of the differences but if I try .Mail it comes up
with 2 security warnings (which ideally I would like to skip). Which
brings me onto the second part how to implement :-

Display
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%S"

so the email sends without intervention.

Any help would be appreciated.

Andrew


Sub Email_test()
ActiveSheet.Copy
sheet_name = ActiveSheet.Name
Set wb = ActiveWorkbook
email_contact_address = "Test_Contact@xxx
File_Title = "Test_sheet"
ActiveSheet.Buttons.Delete
ActiveSheet.Range("A1:X35").ClearComments

ActiveWindow.DisplayGridlines = False

Range("X1:BB50").Select
Selection.Clear
Range("A1").Select

ActiveWindow.DisplayGridlines = False
With wb
SaveAs File_Title
' .Body = "Please note:- " <<<<<<<<<<
SendMail email_contact_address, _
Email_Title

' .Display <<<<<<<<<<
'Application.Wait (Now + TimeValue("0:00:02")) <<<<<<<<<<
'Application.SendKeys "%S" <<<<<<<<<<
ChangeFileAccess xlReadOnly
Close True
End With
Kill Timesheet_Title ' Attempt to delete
open
End Sub


--
aph
------------------------------------------------------------------------
aph's Profile:

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
aph aph is offline
external usenet poster
 
Posts: 1
Default Adding text to body of email with workbook attached.


Thanks to you both. I will give CDO a try.

Andrew


--
aph
------------------------------------------------------------------------
aph's Profile: http://www.excelforum.com/member.php...o&userid=17175
View this thread: http://www.excelforum.com/showthread...hreadid=490717

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
Hyperlink in body of VBA email Chadersmith Excel Discussion (Misc queries) 1 September 17th 09 07:46 PM
Excel 2007 - Email as "Body Text" Alistair Excel Discussion (Misc queries) 4 May 16th 07 05:59 PM
Trying to send an email with body text, to a range of cells [email protected] Excel Discussion (Misc queries) 1 November 29th 06 12:28 AM
body of email disappears when I send an email from Excel ~A Excel Discussion (Misc queries) 0 February 25th 05 10:55 PM
Adding text to the body of an e-mail Greg Maloney Excel Programming 1 June 28th 04 05:01 PM


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