Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Sub BulkEmail()
- Dim EmailList As Range
- Dim EmailAddr As Range
- Dim lst As Long
- lst = Sheet1.Range("C" & Rows.Count).End(xlUp).Row
- Set EmailList = Sheet1.Range("C1:C" & lst)
- For Each EmailAddr In EmailList
- MailMacro EmailAddr.Value
- Next EmailAddr
- End Sub
- Sub MailMacro(outTo As String)
- Dim oApp As Outlook.Application
- Dim oMail As MailItem
- Set oApp = New Outlook.Application
- Set oMail = oApp.CreateItem(olMailItem)
- With oMail
- .To = outTo
- .Subject = "Message Subject"
- .Body = BodyText
- .Display ' or .Send
- End With
- Set oMail = Nothing
- Set oApp = Nothing
- End Sub
- Function BodyText() As String
- BodyText = BodyText & "Hi" & vbNewLine
- BodyText = BodyText & "This is an email" & vbNewLine
- BodyText = BodyText & "Thanks" & vbNewLine
- BodyText = BodyText & "Me" & vbNewLine
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement