Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 7th, 2005, 12:15 PM
Registered User
Join Date: Feb 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default auto send an emal

I am trying to solve this problem. I distribute account statements once a month. Since we have two hundred accounts I wrote a macro that divides the data relevant to each account, which then it automatically sends the information on a sheet as an attachment via outlook. The line in my macro looks like this:

ActiveSheet.SendMail Recipients:=("A12"), Subject:= "bla bli bla"

I do not like this SendMail function, since it doesn't allow me to paste anything into body of the email, which is the point why I am writing here. I want my text in the body of the email, not in the shee, which is an attachment of the email.

After reading the EXCEL 2003 VBA Programmer's Reference, I found a bit more elegant solution with opening up outlook on page[323]:

With MailItem
 .Subject = "Year 2004 Revenue Chart"
 .Body = "Workbook with chart attached"
End With

Sorry for not using the proper terminology, what I want to do is instead of typing the text into quotation marks in the code, I would like to insert a content of a multiple cells range in my active sheet. After naming the range for example:
Selection.Name = "boody")

I wanted to add content of the boody range into the .Body of the email, but it would not work. All I could do was putting there a content of only one cell, for example D5:
.Body = Range("D5")

Could anyone help me how to paste the whole active area of the worksheet into the body of the email in Outlook application?

Pavel Kadera
FinanceSoft, Praha

  #2 (permalink)  
Old February 7th, 2005, 12:48 PM
Friend of Wrox
Join Date: Jan 2005
Location: Bournemouth, Dorset, United Kingdom.
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts

take a look at this recent positng. It should answer some of your questions.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Store procedure,auto send email after X days.(+asp kumiko SQL Server 2005 2 February 29th, 2008 01:15 PM
How to send a auto confirmation mail?? silu95421 Classic ASP Databases 0 October 27th, 2007 04:46 AM
auto tracker function &send personalised email miracles Excel VBA 1 April 27th, 2007 04:43 AM
Send Auto Mail for Birthday wishes bspradeep Classic ASP Professional 4 February 28th, 2007 06:13 AM
Auto send email from command button underscore10304 Access VBA 3 September 26th, 2006 06:41 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.