I am coding in Excel 2013. I've got a table of client data that will increase and decrease in number over time depending my active veteran caseload:
Column A - Last Name
Column B - First Name
Column C - Email Address
Column D - etc...
I need the code to reference column C and place all the emails therein in the BCC of a single Outlook email. The code I have created (through my study) allows for only hard-coded email addresses to the TO, CC or BCC fields of Outlook--with a semicolon between multiple entries. My issue is that the number of email addresses will vary depending on the number of records in the spreadsheet so hard-coding them is useless. The code below has all the functionality I require with the exception of the email problem.
Sub SendBasicEmail()
Dim olApp As Outlook.Application
Dim olEmail As Outlook.MailItem
Set olApp = New Outlook.Application
Set olEmail = olApp.CreateItem(olMailItem)
With olEmail
.BodyFormat = olFormatHTML
.Display
.HTMLBody = "<h3>Testing</h3><br>" & "<br>" & .HTMLBody
.Attachments.Add "xxx/test.pdf"
.To = ""
.BCC = ""
.Subject = "Test Message"
'.Send
End With
End Sub