#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Date 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: 1
Default Date format

marwan hefnawy

Try something like this.


Sub my_date()
Dim MyDate
Dim mydat
MyDate = DateSerial(2004, 7, 30)
mydat = Format(MyDate, "mmmm-yyyy")

MsgBox mydat

End Sub

HTH

Charles


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Date format



Thank you Charles for your reply.
Unfortunatly my problem is not in the date separator between the month
and the year (a space or a dash).
My problem is that the month name and the year number is not written in
english words and I want them to be written in engilsh words (July 2004)
or (July-2004) doesn't matter to me.
Thanks anyway


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
change date format dd/mm/yyyy to Julian date format? itzy bitzy Excel Worksheet Functions 1 December 8th 09 07:42 PM
Convert date + time text format to date format Paul Ho Excel Worksheet Functions 2 May 22nd 07 05:47 PM
Excel 2000 date format cannot be set to Australian date format Brian Jones Excel Discussion (Misc queries) 1 March 30th 05 06:03 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 05: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"