Hello community,
I run a community contact scheme and I'm trying to automate our emailing system as our email lists are already on an excel spread sheet. Due to wanting to contact different groups for different things I put all the contacts in to a single spread sheet and attributed them to different groups. I then run a pivot table to allow filtering to specific groups. I then created a macro (I say created I assembled it from a couple of different answers I found on here and claim no great power of coding). Anyway it works well except I'm having to manually brake up the list to prevent it exceeding the limits on our outlook. How can I make it brake at 49 addresses and then open a new email?
Sub CommandButton2_Click()
Dim objOutlook As Object
Dim cell As Range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim Msg As String
'Create Outlook object
' SET Outlook APPLICATION OBJECT.
Set objOutlook = CreateObject("Outlook.Application")
'Loop through the rows
For Each cell In Columns("E").Cells.SpecialCells(xlCellTypeVisible)
If cell.Value Like "*@*" Then
EmailAddr = EmailAddr & ";" & cell.Value
End If
Next
Msg = "Please review the following message."
Subj = "This is the Subject Field"
'Create Mail Item and view before sending
Dim objEmail As Object
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.bcc = EmailAddr
.Display
End With
End Sub
Many Thanks for any help
I run a community contact scheme and I'm trying to automate our emailing system as our email lists are already on an excel spread sheet. Due to wanting to contact different groups for different things I put all the contacts in to a single spread sheet and attributed them to different groups. I then run a pivot table to allow filtering to specific groups. I then created a macro (I say created I assembled it from a couple of different answers I found on here and claim no great power of coding). Anyway it works well except I'm having to manually brake up the list to prevent it exceeding the limits on our outlook. How can I make it brake at 49 addresses and then open a new email?
Sub CommandButton2_Click()
Dim objOutlook As Object
Dim cell As Range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim Msg As String
'Create Outlook object
' SET Outlook APPLICATION OBJECT.
Set objOutlook = CreateObject("Outlook.Application")
'Loop through the rows
For Each cell In Columns("E").Cells.SpecialCells(xlCellTypeVisible)
If cell.Value Like "*@*" Then
EmailAddr = EmailAddr & ";" & cell.Value
End If
Next
Msg = "Please review the following message."
Subj = "This is the Subject Field"
'Create Mail Item and view before sending
Dim objEmail As Object
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.bcc = EmailAddr
.Display
End With
End Sub
Many Thanks for any help