ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Emailing from Excel (https://www.excelbanter.com/excel-programming/273453-emailing-excel.html)

pvp

Emailing from Excel
 
Is it possible to enter Outlook Express from Excel, using
a bunch of cell in the spreadsheet as the TO addresses for
the email. And other cells as Subject, CC, ...
And then fill in the email and add attachments in Outlook
before sending it.

Thanks

Kerry Bennett

Emailing from Excel
 
Sub EmailFromExcel()

Dim olApp As Outlook.Application, olMail As
Outlook.MailItem
Dim Rng As Range
Dim objOLAttach As Outlook.Attachment

iPath = 'YOUR FILE PATH GO'S HERE

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = Range("to_addresses").Value 'this is a
cell reference for your 'To' email addresses
olMail.CC Range("cc_addresses").Value 'this is a cell
reference for your 'CC' email addresses
olMail.BCC = Range("bcc_addresses").Value 'this is a
cell reference for your 'BCC' email addresses


'email subject here
olMail.Subject = "REPLACE THIS TEXT WITH YOUR EMAIL
SUBJECT"

'main message here
olMail.Body = "Dear ExcelAid" _
& vbCrLf & vbCrLf & "REPLACE THIS TEXT WITH
THE BODY TEXT FOR YOUR EMAIL." _
& vbCrLf & vbCrLf & "Regards," _
& vbCrLf & vbCrLf & "ExcelAid," _
& vbCrLf & "

'attachment
olMail.Attachments.Add iPath 'this will attach the
file you declared earlier.

olMail.Display 'DISPLAYS THE EMAIL

olMail.Send 'WILL AUTO SEND THE EMAIL

End Sub

You will need to have 9.0 Microsoft Outlook Object Library
checked within VB. The 9.0 may vary depending on the
version of Excel you are using.


regards

Kerry Bennett
www.excelaid.com

-----Original Message-----
Is it possible to enter Outlook Express from Excel, using
a bunch of cell in the spreadsheet as the TO addresses

for
the email. And other cells as Subject, CC, ...
And then fill in the email and add attachments in Outlook
before sending it.

Thanks
.



All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com