Tablecloth98
New Member
- Joined
- Nov 15, 2023
- Messages
- 24
- Office Version
- 2021
- Platform
- Windows
I'm currently trying to set up an automated email system. The system is supposed to go down a list of email addresses and email every customer. The code I have so far in vba is:
Sub Email()
Dim EmailSubject As String
Dim SendTo As String
Dim EmailBody As String
Dim ccTo As String
EmailSubject = "Distribution Test"
SendTo = Range("B5")
EmailBody = "Distribution List Test Mail"
Set App = CreateObject("Outlook.Application")
Set Itm = App.createitem(0)
With Itm
.Subject = EmailSubject
.To = SendTo
.Body = EmailBody
.Send
End With
Set App = Nothing
Set Itm = Nothing
End Sub
Where it says SendTo = Range("B5") I'd like to have it email all addresses in column B starting with B5.
I'd also like to specify which email address to send the messages from but can't figure out how to do this.
In the subject line I need to lookup a value from a column (let's say column c) that corresponds to the correct email address.
Does anybody know how I can do this? (Apologies if these are silly questions. I'm very new to macros)
Sub Email()
Dim EmailSubject As String
Dim SendTo As String
Dim EmailBody As String
Dim ccTo As String
EmailSubject = "Distribution Test"
SendTo = Range("B5")
EmailBody = "Distribution List Test Mail"
Set App = CreateObject("Outlook.Application")
Set Itm = App.createitem(0)
With Itm
.Subject = EmailSubject
.To = SendTo
.Body = EmailBody
.Send
End With
Set App = Nothing
Set Itm = Nothing
End Sub
Where it says SendTo = Range("B5") I'd like to have it email all addresses in column B starting with B5.
I'd also like to specify which email address to send the messages from but can't figure out how to do this.
In the subject line I need to lookup a value from a column (let's say column c) that corresponds to the correct email address.
Does anybody know how I can do this? (Apologies if these are silly questions. I'm very new to macros)