Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendMail syntax in Excel

Status
Not open for further replies.

BobChesh

Technical User
Dec 13, 2001
39
GB
I am trying to send a mail from Excel using VBA.

The syntax I am using is:

ActiveWorkbook.SendMail Recipients:=Range("b21:b23"), Subject:=("Closure Data")


This works fine, but I want to amend this to have a "To" recipients and a "cc" recipients.

All my books are about as helpful as a third leg in this area.

Any ideas?


Bob
 
Not sure that you can use the SendMail in that way, I use the below, much easier to change:
Code:
Sub Mail()
Dim myApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Set myItem = myApp.CreateItem(olMailItem)
With myItem
  .Importance = olImportanceHigh
  .To = "e-mailaddress1;e-mailaddress2"
  .Subject = "Sample item"
  .ReadReceiptRequested = False
  .DeleteAfterSubmit = True
  .Body = "Text goes here."
End With
myItem.Send
End Sub
 
Molby

Thanks very much for this, I will keep it for later.

My buddy has searched again and found out that XL does not support a "cc" address in the SendMail or Mailer functions, or at least not for a PC. It does however support it for a Mac, or at least we cannot find it.

Oh well.


Regards

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top