Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Date local format

In the VBA I tried the following:

MyDate = DateSerial(2004, 7, 30)
MsgBox Format(MyDate, "mmmm yyyy")

it gave me the month and the year in my language (as in the regional
options in windows control panel)
I want to force the result to give me "July 2004" regardless the
settings in the windows.
In a worksheet, I can format such a date with "B1mmm yyyy" to give me
what I want.
But in VBA, the "format" function didn't accept the "B1mmm yyyy" to
format MyDate.
Any ideas?
Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Date local format

Marwan,

This function will do the trick:

Function getDString (myDate)
getDString = Application.GetCustomListContents(4)(Month(myDate) ) & " " &
Year(myDate)
End Function

Stan Scott
New York City

"marwan Hefnawy" wrote in message
om...
In the VBA I tried the following:

MyDate = DateSerial(2004, 7, 30)
MsgBox Format(MyDate, "mmmm yyyy")

it gave me the month and the year in my language (as in the regional
options in windows control panel)
I want to force the result to give me "July 2004" regardless the
settings in the windows.
In a worksheet, I can format such a date with "B1mmm yyyy" to give me
what I want.
But in VBA, the "format" function didn't accept the "B1mmm yyyy" to
format MyDate.
Any ideas?
Thanks in advance



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
Convert date + time text format to date format Paul Ho Excel Worksheet Functions 2 May 22nd 07 05:47 PM
VBA Setting .Value to a date does not respect local system setting Frank_Hamersley Excel Programming 13 July 18th 04 02:51 PM
Reference styles and local/non-local formulae - international problems. Alan Howells[_2_] Excel Programming 2 February 24th 04 09:52 AM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"