Excel 2021 - mass email with vba - combine html code with cell values

BrerRabbit

Board Regular
Joined
Aug 20, 2023
Messages
66
Office Version
  1. 2021
  2. 2016
  3. 2013
Platform
  1. Windows
I'm aware of how to do mass emails from excel with vba. What's eluding me is how to retrieve cell values and combine with html code for formatting purposes. For example, I need to retrieve the text from E4 which is a date, into another cell which will have formatting html code, which will then be captured by vba.

E4: Saturday, 23 December 2023 (generated as long date from 23/12/23)
G27: = "<a href="""&E4&""><span style="text-align:center">Search</span></a> (this isn't working as Excel is rejecting it)

VBA
strBody2 = ThisWorkbook.Sheets("CHRISTMAS INVITATIONS").Cells(27, 7).Text

In OutMail
.HTMLBody = strBody & strXmasPartyDate & strBody2 & strXmasLocation & strBody3 & strRSVP & .HTMLBody

I need to do for date, email address and for general text as well. Yes, this has to be generated from Excel. I'm avoiding merging with Word.

1701766981270.png
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top