help with date not showing correctly

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
721
Office Version
  1. 2016
Platform
  1. Windows
H6 is formatted as Range("H6").NumberFormat = "dddd, mmmm d".

I'm using the following to populate the body of an email.

VBA Code:
begins = "Our first session begins - <b style=""font-family:Courier New; font-size: 15px; color:#c00000""> " & Range("H6") & "<br><br>"

The problem I'm having is, instead of dddd, mmmm d showing in the email, I'm getting mm/dd/yyyy.

What would you suggest?

Thank you
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
In VBA, Range("H6") will give you the underlying value of the cell, regardless of how it is formatted for display. Here is the easiest option:

Rich (BB code):
begins = "Our first session begins - <b style=""font-family:Courier New; font-size: 15px; color:#c00000""> " & Range("H6").DisplayFormat & "<br><br>"
 
Upvote 0
In VBA, Range("H6") will give you the underlying value of the cell, regardless of how it is formatted for display. Here is the easiest option:

Rich (BB code):
begins = "Our first session begins - <b style=""font-family:Courier New; font-size: 15px; color:#c00000""> " & Range("H6").DisplayFormat & "<br><br>"
Thank you, but doing so I go a run-time error 438. Object doesn't support this property or method.
 
Upvote 0
Sorry, try this one

Rich (BB code):
begins = "Our first session begins - <b style=""font-family:Courier New; font-size: 15px; color:#c00000""> " & Range("H6").Text & "<br><br>"
 
Upvote 0
Solution
Sorry, try this one

Rich (BB code):
begins = "Our first session begins - <b style=""font-family:Courier New; font-size: 15px; color:#c00000""> " & Range("H6").Text & "<br><br>"
That was the trick! Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,974
Members
448,934
Latest member
audette89

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