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:
(Range("A2:B6").Select
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
|