Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
How to: Localize Excel Solutions

How to: Localize Excel Solutions

Localization consists primarily of translating the user interface of your application. Instead of hard coding strings into your application, you should store the strings in a separate file. You can store strings for Microsoft Office Excel 2003 user interface elements in the project's default assembly resource file. The file is named MyResources.resx in Visual Basic projects, and Resources.resx in C# projects. Copies of the resource file can then be translated into multiple languages.


The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Storing Text in a Resource File

To add text to a resource file

  1. Open the Excel project that you want to localize.

  2. On the Project menu, select <Projectname> Properties.

    The Project Designer opens.

  3. Click Resources in the Project Designer to open the Resources pane.

  4. Select Strings in the Categories combo box.

  5. Add a unique identifier to the Name column and the text to be localized in the Value column for each string you want to localize. For example:

    Name Value


    create unscheduled order


    You can use the Comment column to provide notes or instructions to the translator.

Retrieving Text from a Resource File

After you have added each string to the resource file, the strings can be loaded at runtime.

To add a value to a cell using a Resource file.

  1. In the Startup event handler of Sheet1, add a NamedRange control to cell A1.

    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", missing], "namedRange1");
  2. Assign a value from the resource file.

    namedRange1.Value2 = Properties.Resources.ListCreateUnscheduledOrder;

Localizing the Resource File

To localize a resource file

  1. Copy the resource file and name it with the culture code of the target language. For example, to create a file that will be localized into Japanese, copy the Resources.resx file and name it Resources.ja.resx.

  2. Have the resource file translated into the languages you want to support. For example, have the strings in Resources.ja.resx translated into Japanese.

  3. Add the translated resource files to your project so that the project system can compile the resource files into satellite assemblies.

Loading Resources Based on Office User Interface Language

The Microsoft .NET Framework loads resources based on the Microsoft Windows user interface language. Office-based solutions, however, are typically written to load resources based on the Office user interface (UI) language. The first example below demonstrates how to load resources that match the Office UI language, regardless of which version of Office is installed. The second example shows how to override both the Office UI language and the default Microsoft .NET Framework behavior.

To load resources based on Office (multiple language versions of Office)

  • Add the following code to the Startup event handler for the workbook and each of the worksheets.

    System.Threading.Thread.CurrentThread.CurrentUICulture =
        new System.Globalization.CultureInfo(

If you do not have multiple language versions of Office, you can force resources to load by assigning the matching culture ID to the CurrentCulture property of the CultureInfo object (or that of the current thread). This can be useful for debugging purposes, or as part of custom code that allows users to select which resources to load.

To load resources based on Office (using the Culture ID)

  • Add the following code to the Startup event handler for the workbook and each of the worksheets. This example passes the culture ID for German (Germany). For a list of culture IDs, see CultureInfo.

    System.Threading.Thread.CurrentThread.CurrentUICulture = 
        new System.Globalization.CultureInfo("de");

Localizing Custom Controls

You can add custom controls to the actions pane in Microsoft Visual Studio 2005 Tools for the Microsoft Office System solutions. You can enable localization of a user control or an actions pane control in the same way you would localize a Windows form. For more information see, Walkthrough: Localizing Windows Forms.

To enable localization of a custom control

  1. From the View menu, select Properties Window.

  2. Select the user control or actions pane control in the designer and change the Localizable property to true.

See Also

Community Additions

© 2015 Microsoft