Mahesh Rana
New Member
- Joined
- Aug 2, 2018
- Messages
- 6
Hi!
VBA to send auto mail by extracting mail address from worksheet, BUT
Not able to extract address from the whole column. It works - but on single cell if I write Range ("A1").
Pls. suggest the correction to be done (I think it should be in - marked as Red)
VBA to send auto mail by extracting mail address from worksheet, BUT
Not able to extract address from the whole column. It works - but on single cell if I write Range ("A1").
Pls. suggest the correction to be done (I think it should be in - marked as Red)
Rich (BB code):
Option Explicit
Private Sub CommandButton1_Click()
On Error GoTo ErrHandler
' SET Outlook APPLICATION OBJECT.
Dim objOutlook As Object
Set objOutlook = CreateObject("Outlook.Application")
' CREATE EMAIL OBJECT.
Dim objEmail As Object
Set objEmail = objOutlook.CreateItem(0)
On Error Resume Next
With objEmail
.To = Range("A:A")
.CC = Range("B:B")
.BCC = Range("C:C")
.Subject = "COLD CHAIN DISPATCHES" & Date
.Body = "Pls. have the details in attachment."
.Attachments.Add ("C:\COLD CHAIN.xlsx")
.Send
End With
' CLEAR.
Set objEmail = Nothing: Set objOutlook = Nothing
ErrHandler:
'
End Sub