Forum Discussion
VBA Coding - inserting dates into body of email
- Apr 24, 2019
hi, there!
Please try replacing the .HTML part of the code with:
Dim DueDate as String
DueDate=Format(Thisworkbook.Sheets("Sheet4").Range("D3").Value,"YYYY-MM-dd")
.HTMLBody = "Hello XX,<p> I'm looking to confirm the dates for delivery of your Project information. Per my schedule we require the information to be delivered by" & DueDate & ". Please can you confirm with me that this is feasible?<p> Many thanks,<p> "
I am assuming the range D3 in sheet Sheet4 has a date value. You can replace YYYY-MM-dd with another date format of your preference.
Please let me know how it goes. Good luck!
Doesn't come up directly with the debug option on error so I have manually stepped into the code as per the attached screenshots.
Debug Part 1Debug Part 2Debug Part 3Debug Part 4Debug Part 5Debug Part 6 - Error
- what is the name of the sheet tab where your date is? Is it "Sheet4"?