#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Email code

I have the following VBA code that works, but I would like to avoid having to
click the OE message box that asks if you want to send the email when you run
the code. I was also wondering if you can specify text for the body of the
email, not something that changes all the time, it will be the same text each
time.

Sheets("Pay Slip").Visible = True
Sheets("Pay Slip").Select
Sheets("Pay Slip").Copy
Range("A1:G17").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("a1").Select
ActiveWorkbook.SendMail ", Subject:="Pay
Slip for Adam Brown - Claim No 16420EML"
ActiveWorkbook.Close SaveChanges:=False
Sheets("Pay Slip").Select
Sheets("Pay Slip").Visible = False


End Sub

Any help would be appreciated
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Email code

Use the outlook object..

Refer the below link for help
http://www.rondebruin.nl/mail/folder2/mail1.htm
--
If this post helps click Yes
---------------
Jacob Skaria


"ozhunter" wrote:

I have the following VBA code that works, but I would like to avoid having to
click the OE message box that asks if you want to send the email when you run
the code. I was also wondering if you can specify text for the body of the
email, not something that changes all the time, it will be the same text each
time.

Sheets("Pay Slip").Visible = True
Sheets("Pay Slip").Select
Sheets("Pay Slip").Copy
Range("A1:G17").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("a1").Select
ActiveWorkbook.SendMail ", Subject:="Pay
Slip for Adam Brown - Claim No 16420EML"
ActiveWorkbook.Close SaveChanges:=False
Sheets("Pay Slip").Select
Sheets("Pay Slip").Visible = False


End Sub

Any help would be appreciated

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
Code to send email to address within selection in Excel workbook vic1 Excel Discussion (Misc queries) 3 May 28th 08 09:51 PM
send wkbk as an email attachment with an email address copied from SueInAtl Excel Discussion (Misc queries) 0 May 21st 07 10:53 PM
Need help with Email Code (PLEASE) [email protected] Excel Worksheet Functions 4 October 21st 06 01:55 PM
can I copy a column of email addresses, paste into email address? Lizizfree New Users to Excel 4 July 20th 06 10:03 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM


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