ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   name of month in national language (https://www.excelbanter.com/excel-programming/345950-name-month-national-language.html)

Stefi

name of month in national language
 
Hi All,

I wanted to get the Hungarian name of months in VBA in my Hungarian version
with the following statement:

monthname = WorksheetFunction.Text(DateSerial(1900, monthnum, 1), "mmmm")

It returned the English month names.

My Windows language setting is right (Hungarian),
=Szöveg(Dátum(1900; monthnum; 1); "hhhh")
which is Hungarian translation of
=Text(Date(1900, monthnum, 1), "mmmm")
in my Excel 2000 returns the right Hungarian month names.

How can I get Hungarian month names in VBA?

Thanks,
Stefi


Ron Rosenfeld

name of month in national language
 
On Fri, 18 Nov 2005 08:09:27 -0800, "Stefi"
wrote:

Hi All,

I wanted to get the Hungarian name of months in VBA in my Hungarian version
with the following statement:

monthname = WorksheetFunction.Text(DateSerial(1900, monthnum, 1), "mmmm")

It returned the English month names.

My Windows language setting is right (Hungarian),
=Szveg(Dtum(1900; monthnum; 1); "hhhh")
which is Hungarian translation of
=Text(Date(1900, monthnum, 1), "mmmm")
in my Excel 2000 returns the right Hungarian month names.

How can I get Hungarian month names in VBA?

Thanks,
Stefi


Are these correct?

janur
februr
mrcius
prilis
mjus
jnius
jlius
augusztus
szeptember
oktber
november
december

If so, try using the VBA Format function.

I generated the above using my US version of excel, with the Windows regional
setting set to Hungarian, and the following code:

---------------------
Sub foo()
Dim monthnum As Integer

For monthnum = 1 To 12
Debug.Print Format(DateSerial(2005, monthnum, 1), "mmmm")
Next monthnum

End Sub
---------------------

The Format function is supposed to be locale aware. I don't know why the
worksheetfunction.text doesn't work.


--ron

Ron de Bruin

name of month in national language
 
Hi Stefi

Look in the VBA help for
Application.International


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Stefi" wrote in message ...
Hi All,

I wanted to get the Hungarian name of months in VBA in my Hungarian version
with the following statement:

monthname = WorksheetFunction.Text(DateSerial(1900, monthnum, 1), "mmmm")

It returned the English month names.

My Windows language setting is right (Hungarian),
=Szveg(Dtum(1900; monthnum; 1); "hhhh")
which is Hungarian translation of
=Text(Date(1900, monthnum, 1), "mmmm")
in my Excel 2000 returns the right Hungarian month names.

How can I get Hungarian month names in VBA?

Thanks,
Stefi




Stefi

name of month in national language
 
Thanks Ron, it works, but it's not clear for me, why does format code "mmmm"
have different meanings in Text and Format functions?

Regards,
Stefi


Ron Rosenfeld ezt *rta:

On Fri, 18 Nov 2005 08:09:27 -0800, "Stefi"
wrote:

Hi All,

I wanted to get the Hungarian name of months in VBA in my Hungarian version
with the following statement:

monthname = WorksheetFunction.Text(DateSerial(1900, monthnum, 1), "mmmm")

It returned the English month names.

My Windows language setting is right (Hungarian),
=Szöveg(Dátum(1900; monthnum; 1); "hhhh")
which is Hungarian translation of
=Text(Date(1900, monthnum, 1), "mmmm")
in my Excel 2000 returns the right Hungarian month names.

How can I get Hungarian month names in VBA?

Thanks,
Stefi


Are these correct?

január
február
március
április
május
június
július
augusztus
szeptember
október
november
december

If so, try using the VBA Format function.

I generated the above using my US version of excel, with the Windows regional
setting set to Hungarian, and the following code:

---------------------
Sub foo()
Dim monthnum As Integer

For monthnum = 1 To 12
Debug.Print Format(DateSerial(2005, monthnum, 1), "mmmm")
Next monthnum

End Sub
---------------------

The Format function is supposed to be locale aware. I don't know why the
worksheetfunction.text doesn't work.


--ron


Ron Rosenfeld

name of month in national language
 
On Sun, 20 Nov 2005 23:31:03 -0800, "Stefi"
wrote:

Thanks Ron, it works, but it's not clear for me, why does format code "mmmm"
have different meanings in Text and Format functions?

Regards,
Stefi



VBA is said to be very US-centric. Excel and VBA are really two different
programs. And I don't know enough about internationally compliant coding to be
able to answer your question.

I don't understand is why the application.worksheetfunction.text, when used in
VBA with the "hhhh" coding, (on a machine with Hungarian regional settings)
doesn't work in VBA.


--ron

Stefi

name of month in national language
 
As far as I experienced there are inconsistencies in the way VBA coding is
adjusted to regional settings, e.g. if one records a formula-entering macro
in Hungarian, say
=SZÖVEG(MA();"hhhh")
the VBA code result will be
ActiveCell.FormulaR1C1 = "=TEXT(TODAY(),""hhhh"")"
where the function names are translated but "hhhh" coding remains Hungarian.

Never mind, I'm glad about that you found the right path in this jungle!

Regards,
Stefi

Ron Rosenfeld ezt *rta:

On Sun, 20 Nov 2005 23:31:03 -0800, "Stefi"
wrote:

Thanks Ron, it works, but it's not clear for me, why does format code "mmmm"
have different meanings in Text and Format functions?

Regards,
Stefi



VBA is said to be very US-centric. Excel and VBA are really two different
programs. And I don't know enough about internationally compliant coding to be
able to answer your question.

I don't understand is why the application.worksheetfunction.text, when used in
VBA with the "hhhh" coding, (on a machine with Hungarian regional settings)
doesn't work in VBA.


--ron


Ron Rosenfeld

name of month in national language
 
On Mon, 21 Nov 2005 04:29:04 -0800, "Stefi"
wrote:

As far as I experienced there are inconsistencies in the way VBA coding is
adjusted to regional settings, e.g. if one records a formula-entering macro
in Hungarian, say
=SZVEG(MA();"hhhh")
the VBA code result will be
ActiveCell.FormulaR1C1 = "=TEXT(TODAY(),""hhhh"")"
where the function names are translated but "hhhh" coding remains Hungarian.

Never mind, I'm glad about that you found the right path in this jungle!

Regards,
Stefi



"Onward through the fog"
--ron


All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com