XL2000: Creating Macros for Different Language Versions


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 Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

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

ID članka: 213833 - posljednja izmjena: 13. srp 2009. - verzija: 1

Povratne informacije