XLL+ Class Library

String substitutions

An add-in contains several types of string which you might consider localizing, so that they appear in the language of the user.

In general, the technique for localizing strings in XLL+ is as follows:

  1. Create several string tables in the application's resource file, one for each language you wish to support.
  2. Add each string to each table in the appropriate language, using the same resource ID in each string table.
  3. Where the string would normally appear, for instance in the XLL+ Function Wizard, enter #NNN instead of a string. NNN should be the numeric version of the resource ID.
At run-time, the XLL+ library will automatically replace the #NNN place-holder with a string in the correct language.

String resource IDs

Resource IDs are made up of prefixed integers (either decimal or hexadecimal), and can be in one of the following forms:

TypeExamplesTranslation
Regional settings #123
#0x7B
Will be replaced by a string in the language implied by the user's current regional settings, if it can be found in the resource file. If the language cannot be found, then English will be used. The function used to detect the current language is XllGetStringLanguageID.
Excel version #@123
#@0x7B
Will be replaced by a string in the language implied by the Excel version, if it can be found in the resource file. If the language cannot be found, then language implied by the user's current regional settings will be used. If that language cannot be found, English will be used. The function used to detect the Excel version language is XllGetExcelLanguageID.

Using resource IDs

You can use a resource ID instead of a string in the following places:

Next: Types of string >>