jonas vermeulen
jonas vermeulen

Reputation: 1245

Internationalize forms in excel vba

In my excel file i have some macro's that use forms. Now i want the labels, buttons, etc translated depending on the user language. I guess there is not something like resource files like in .net

but i'm not sure what is the best option to do this translation. Any ideas?

Upvotes: 0

Views: 776

Answers (1)

asp8811
asp8811

Reputation: 803

To get the current user language:

 Application.LanguageSettings.LanguageID(msoLanguageIDUI)

This will return a Locale ID based on the current user's language settings. To match this ID to a location and thus a language, go here. You will need to translate your controls yourself.

How you then choose to populate the controls is up to use, but I would create a Select Case for the Locale ID and the languages you expect to encounter, with a default if you didn't include the user's language. It's a pretty cumbersome solution from a "I have to type in all of this stuff" standpoint," and I'm sure there's a better one, but it makes the workbook very portable and independent of any other files.

Upvotes: 2

Related Questions