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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change locale (date language) on variable 1

Status
Not open for further replies.

MikeCDPQ

Technical User
Sep 11, 2003
173
CA
Hi everyone,

A cell can easily be formatted as a date with a different language. Typically, one would format cell and select an entry that is listed in the "locale (location):" dropdown field.

One could also do the same through using a CUSTOM format and select a value like: [$-F800]dd mmmm yyyy
which would typically show the date in French.

I recorded a macro which gives me following code:

Range("B2").Select
Selection.NumberFormat = "[$-409]mmmm d, yyyy;@"

This is what I want but applied to a variable in my VB code rather than on a cell.

My Regional settings are set to French but I need to extract some date calculations with the month showing in English rather than in French.

I have tried different venues but so far no success...

Any ideas ??

Thanks,

Mike


 
Hi,
Code:
myDate = Application.Text(Range("B2"), "mmmm d, yyyy")
:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Of course, it had to be so simple.

Thanks a million once again.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top