Microsoft KB Archive/213833

= XL2000: Creating Macros for Different Language Versions =

Article ID: 213833

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q213833





SUMMARY
In Microsoft Excel 2000, you can determine the country code that corresponds to the version of Excel that you are running. These country codes can be helpful in creating custom applications.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

Excel is currently available in over 30 international languages. These languages and their corresponding country codes are as follows:   Language        Country code    Countries/regions -

Arabic               966       (Saudi Arabia) Czech                42        (Czech Republic) Danish               45        (Denmark) Dutch                31        (The Netherlands) English              1         (The United States of America) Farsi                98        (Iran) Finnish              358       (Finland) French               33        (France) German               49        (Germany) Greek                30        (Greece) Hebrew               972       (Israel) Hungarian            36        (Hungary) Indian               91        (India) Italian              39        (Italy) Japanese             81        (Japan) Korean               82        (Korea) Norwegian            47        (Norway) Polish               48        (Poland) Portuguese (Brazil)  55        (Brazil) Portuguese           351       (Portugal) Russian              7         (Russian Federation) Simplified Chinese   86        (People's Republic of China) Spanish              34        (Spain) Swedish              46        (Sweden) Thai                 66        (Thailand) Traditional Chinese  886       (Taiwan) Turkish              90        (Turkey) Urdu                 92        (Pakistan) Vietnamese           84        (Vietnam) The codes shown above are derived from the country codes used by the telephone system in the United States of America.

In a custom application, it may be necessary to determine which language version of Excel is running. For example, if you are writing a custom application for your company, and the company has offices in two different countries, the country code makes it possible to write a single macro for both offices. Additionally, you can display different dialog boxes based on the language version of Excel being used. Below are examples of returning and using the country code in a Microsoft Visual Basic for Applications macro.

Sample Visual Basic Procedure
You can use the Application.International function to return information about the current country and international settings of Excel. The built-in constant xlCountryCode returns the country code.

The following sample macro returns the country code and then, based on that code, displays "Hello" in the appropriate language: Sub Code Country_Code = Application.International(xlCountryCode) If Country_Code = 1 Then MsgBox ("Hello") ElseIf Country_Code = 34 Then MsgBox ("Hola") End If End Sub

Additional query words: foreign XL2000

Keywords: kbdtacode kbhowto kbinfo kbprogramming KB213833

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.