Jyggalag
Active Member
- Joined
- Mar 8, 2021
- Messages
- 445
- Office Version
- 365
- 2019
- Platform
- Windows
Hi all,
I currently have this setup in Excel:
This code links to the following columns:
My issue right now is that when I use the code, it pops up one email to send to all of the users (in one email). I want to send my emails separately, and was therefore wondering if somebody could assist me in making a change to my code, so it can do that?
Please let me know if you need more information!
Thank you
Kind regards,
Jyggalag
I currently have this setup in Excel:
VBA Code:
Sub send_email_complete()
Dim outlookApp As Outlook.Application
Dim SendEmailTo As Outlook.MailItem
Dim source_file, to_emails, bcc_emails As String
Dim i, j As Integer
Set outlookApp = New Outlook.Application
Set SendEmailTo = outlookApp.CreateItem(olMailItem)
For i = 2 To 10
to_emails = to_emails & Cells(i, 15) & ";"
bcc_emails = bcc_emails & Cells(i, 16) & ";"
Next i
For j = 2 To 2
source_file = "\\COMPANY.MSTD.COMPANY.NET\userdata\t686944\home\Documents\TEST folder\" & Cells(j, 17)
SendEmailTo.Attachments.Add source_file
Next
ThisWorkbook.Save
source_file = ThisWorkbook.FullName
SendEmailTo.BCC = bcc_emails
SendEmailTo.To = to_emails
SendEmailTo.Subject = "Files for Everyone"
SendEmailTo.HTMLBody = "Dear all,<br/>" & "<BR>" & _
"bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text ""bunch of insignificant text"" bunch of insignificant text bunch of insignificant text bunch of insignificant text<br/>" & "<BR>" & _
"bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text .<br/>" & "<BR>" & _
"bunch of insignificant text ,<b><u> bunch of insignificant text bunch of insignificant text </b></u> bunch of insignificant text bunch of insignificant text bunch of insignificant text <b>KPIs and Annual Confirmations</b>. This tool will also be used for <b>bunch of insignificant text </b>. bunch of insignificant text bunch of insignificant text bunch of insignificant text .<br/>" & "<BR>" & _
"bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text .<br/>" & "<BR>" & _
"bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text.<br/>" & "<BR>" & _
"bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text .<br/>" & _
"bunch of insignificant text bunch of insignificant text (bunch of insignificant text ""bunch of insignificant text ""), bunch of insignificant text .<b> bunch of insignificant text bunch of insignificant text.</b><br/>" & _
"<b> bunch of insignificant text bunch of insignificant text:<br/>" & "<BR>" & _
"<b>1- bunch of insignificant text :</b> bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text:<br/>" & <BR> & _
"<b>-</b> bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text<br/>" & _
"<b>-</b> bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text<br/>" & _
"<b>-</b> bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text bunch of insignificant text <br/>" & _
"<b>-</b> bunch of insignificant text bunch of insignificant text <b> bunch of insignificant text bunch of insignificant text bunch of insignificant text</b>.<br/>" & "<BR>" & _
"<b>2-</b> bunch of insignificant text <b> bunch of insignificant text </b>, bunch of insignificant text bunch of insignificant text <b>10.02.22</b><br/>" & "<BR>" & _
"bunch of insignificant text bunch of insignificant text bunch of insignificant text <u> bunch of insignificant text </u><br/>" & "<BR>" & _
"Kind regards</br>" & "<BR>"
This code links to the following columns:
My issue right now is that when I use the code, it pops up one email to send to all of the users (in one email). I want to send my emails separately, and was therefore wondering if somebody could assist me in making a change to my code, so it can do that?
Please let me know if you need more information!
Thank you
Kind regards,
Jyggalag