Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Trouble with german / english dateformatting

Hi,
I have some trouble with formatting a datecolumn in Excel. At first I
export the datefields from a SQL-Database (without problems!). The
exported columns look like this:
24.04.2005 00:00:00
Afterwards I'm trying to format the date like DD MMM YYYY (e.g. 24 Apr
2005). This works fine... but the abbreviations (shortcuts) of the
months are always german. I need the english version. For example:
German: Okt / English: Oct
German: Mrz / English: Mar
German: Dez / English: Dec
I already tried
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US")
but it seems to have no effect.

I'm using MS Visual Studio 2003 with MS Excel 9.0 Object Library.
I'm having MS Excel 2000 installed on my machine.
Here's the code I'm using (only the relevant part):

================================================== ================='Set
CultureInfo
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US")

Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook

xlApp.Visible = False

'Open Workbook
xlBook = xlApp.Workbooks.Open("C:\Test.xls")


xlBook.Worksheets("Test").columns("A:A").Select()

xlApp.Selection.Numberformat = "DD MMM YYYY"


'Save Workbook
xlBook.Save()

'Quit excel
xlBook.Close(SaveChanges:=True)
xlApp.Quit()
xlBook = Nothing
xlApp = Nothing
================================================== =================


Hopefuly someone has some experience in this. Thanks in advance

Cheers Alex

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trouble with german / english dateformatting

I think that is governed by the regional settings in Windows. I don't think
you can change it for a specific worksheet or workbook and still keep it
stored as a date - you would have to format it in code and place it as a
string.

--
Regards,
Tom Ogilvy

"Alex" wrote in message
ups.com...
Hi,
I have some trouble with formatting a datecolumn in Excel. At first I
export the datefields from a SQL-Database (without problems!). The
exported columns look like this:
24.04.2005 00:00:00
Afterwards I'm trying to format the date like DD MMM YYYY (e.g. 24 Apr
2005). This works fine... but the abbreviations (shortcuts) of the
months are always german. I need the english version. For example:
German: Okt / English: Oct
German: Mrz / English: Mar
German: Dez / English: Dec
I already tried
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US")
but it seems to have no effect.

I'm using MS Visual Studio 2003 with MS Excel 9.0 Object Library.
I'm having MS Excel 2000 installed on my machine.
Here's the code I'm using (only the relevant part):

================================================== ================='Set
CultureInfo
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US")

Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook

xlApp.Visible = False

'Open Workbook
xlBook = xlApp.Workbooks.Open("C:\Test.xls")


xlBook.Worksheets("Test").columns("A:A").Select()

xlApp.Selection.Numberformat = "DD MMM YYYY"


'Save Workbook
xlBook.Save()

'Quit excel
xlBook.Close(SaveChanges:=True)
xlApp.Quit()
xlBook = Nothing
xlApp = Nothing
================================================== =================


Hopefuly someone has some experience in this. Thanks in advance

Cheers Alex



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Trouble with german / english dateformatting

I think this is controlled by your Regional settings in control panel.??

"Alex" wrote:

Hi,
I have some trouble with formatting a datecolumn in Excel. At first I
export the datefields from a SQL-Database (without problems!). The
exported columns look like this:
24.04.2005 00:00:00
Afterwards I'm trying to format the date like DD MMM YYYY (e.g. 24 Apr
2005). This works fine... but the abbreviations (shortcuts) of the
months are always german. I need the english version. For example:
German: Okt / English: Oct
German: Mrz / English: Mar
German: Dez / English: Dec
I already tried
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US")
but it seems to have no effect.

I'm using MS Visual Studio 2003 with MS Excel 9.0 Object Library.
I'm having MS Excel 2000 installed on my machine.
Here's the code I'm using (only the relevant part):

================================================== ================='Set
CultureInfo
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture("en-US")

Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook

xlApp.Visible = False

'Open Workbook
xlBook = xlApp.Workbooks.Open("C:\Test.xls")


xlBook.Worksheets("Test").columns("A:A").Select()

xlApp.Selection.Numberformat = "DD MMM YYYY"


'Save Workbook
xlBook.Save()

'Quit excel
xlBook.Close(SaveChanges:=True)
xlApp.Quit()
xlBook = Nothing
xlApp = Nothing
================================================== =================


Hopefuly someone has some experience in this. Thanks in advance

Cheers Alex


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Trouble with german / english dateformatting

Hey

thanks a lot for your quick responses. Actually these settings are the
key! If I change the "Region- and Language Options" to english (US)
the dateformat is correct. I just hoped that there would be a
workaround or something. But probably this is the only solution.
Maybe I have to do some programming to check the content for e.g. Dez,
Okt, etc. and replace it with Dec, Oct and so on. This will make my
application slow but it should work.

Thanks again!

Cheers Alex

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
Rename Worksheets From German to English Sheet1 wayne Setting up and Configuration of Excel 11 July 17th 09 12:59 PM
this formulas is in English ... what is it in German? Andrewsan Excel Discussion (Misc queries) 8 July 4th 07 10:56 AM
German translation for english formulas Estyl Excel Discussion (Misc queries) 2 May 30th 07 12:58 PM
english equivalent to German formular <ARBEITSTAG? guruperi Excel Discussion (Misc queries) 2 September 19th 06 03:19 PM
Sharing worksheets between English and German versions Roger Nye Excel Discussion (Misc queries) 5 June 8th 05 01:49 PM


All times are GMT +1. The time now is 12:30 PM.

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"