Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Format Function to show full name of the month 2

Status
Not open for further replies.

kjv1611

New member
Jul 9, 2003
10,758
US
I am wanting to use code to display the month in standard spelled out format to put in an email message. So, for today, the full date would then read:
July 21, 2006

Well, I thought I was going to be able to use the Format() function in VBA, but it doesn't seem to do what I want, I don't think.

The help file for the Format() function says:

Symbol Range
d 1-30
dd 1-30
ww 1-51
mmm Displays full month names (Hijri month
names have no abbreviations).
y 1-355
yyyy 100-9666

Well, I tried 3, but it abbreviated the month. So, I tried 4, and it worked perfectly, since this month has 4 characters in the name. But, how would I make it adapt according to what month it is, such as November or December? Adding extra "m" characters in the Format function just repeated the month name.

I'm hoping there's a short easy way that I'm missing that I can use. I can do it the hard way, but I figure there's got to be a simple way that I'm just missing.

I also tried:
Code:
Month(Date)
but that just returns the number, rather than the spelled out form.

Thanks for any suggestions!
 
MajP's point is, 4 will work for ALL months.
It's a coincidence that this month has 4 letters.
All formatting for month & day,
will give full name if you use 4x the code.

Format(date,"dddd") = "Wednesday"
Format(#12/1/06#,"mmmm") = "December"
Format(date,"dddd, mmm dd/yy") = "Saturday, Jul 22/06
 
Thanks for that clarification, MajP and Zion7! I'll be sure to remember that for future reference as well as for the current situation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top