LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA xlcountrycode always returns 1 = US

Late post I know, but in the future, if someone is looking for an answer. Try using xlcountrysetting instead, this should work.

On Sunday, October 12, 2008 6:00 PM MikeVB wrote:


I have been using a VBA script for 3-4 years now with no issues, but just
recently noticed a problem with new PC's or refreshed to new laptops where
the region seems stuck to US (1).

Despite changing the PC region/local language in Control panel to "English
UK" - it always reads 1. Is there a hiden registry entry where a PC OS build
can force xlcountrycode to 1 (US) , even though date format/locale shows and
works as UK(44).

I can take the same file VBA acript onto my PC or another PC run it and
returns "44" for the UK as expected. Yet if I compare the Region-Language
settings thoroughly to format/customise etc etc - they are identical.

So why do our new PC's think they are US - xlcountrycode returns "1" always

sample code below
===============
If Application.International(xlCountrySetting) < 1 And
Application.International(xlCountrySetting) < 2 Then
deal_info(7) = Format(Cells(row_ptr_b, date_ref), "dd-mmm-yyyy")
Else
deal_info(7) = Format(Cells(row_ptr_b, date_ref), "mmm-dd-yyyy")
End If



On Sunday, October 12, 2008 7:15 PM JLGWhi wrote:


The help file says that xlCountryCode is the version of Excel, and
xlCountrySetting is the Windows international setting.

"MikeVBA" wrote:



On Monday, October 13, 2008 3:59 AM MikeVB wrote:


Apologies I was so entralled with the problem , i used the wrong
term.......... "xlcountry setting" is always returning 1 when it should
return 44.....as you can see in the VBA code I am checking <xlcountrysetting.

I aslo wrote this region check routing as a test spreadsheet - both come up
1 - despite being English UK region/locale, keyboard Uk etc etc.....but it
never returns 44 for the new User PC's, when it should for UK.


Sub test()
Dim excel_view As Long
Dim windows_view As Long

excel_view = Application.International(xlCountryCode)
windows_view = Application.International(xlCountrySetting)
Cells(2, 5) = "Excel Country code - where I am"
Cells(2, 4) = excel_view
Cells(4, 5) = "Microsoft Windows OS view - where I am"
Cells(4, 4) = windows_view
End Sub

"JLGWhiz" wrote:



Submitted via EggHeadCafe
ASP.NET Base64 Image Encoding via the Data: protocol
http://www.eggheadcafe.com/tutorials...-protocol.aspx

 
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
Index with mulitple value returns and muliple column returns solar+CSE Excel Worksheet Functions 4 June 12th 09 04:43 PM
Date returns always returns: 00 January 1900 ArcticWolf Excel Worksheet Functions 2 September 11th 08 12:31 PM
Createobject returns null in Excel [email protected] Excel Discussion (Misc queries) 1 March 27th 06 04:04 AM
Excel Returns Blank Jeff Excel Programming 8 May 10th 05 02:34 AM
Excel VBA - carriage returns KD[_3_] Excel Programming 1 September 7th 04 09:06 PM


All times are GMT +1. The time now is 09:33 PM.

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

About Us

"It's about Microsoft Excel"