Forum Discussion

R-o-x-o's avatar
R-o-x-o
Copper Contributor
Apr 24, 2019
Solved

VBA Coding - inserting dates into body of email

Hi,   I'm currently creating a VBA Macro whereby I can draft multiple emails at once, in order to remind people of their respective deadlines. The deadlines are driven from an excel worksheet. The ...
  • Celia_Alves's avatar
    Apr 25, 2019

    R-o-x-o 

    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!

     

     

     

Resources