Author: Lou Adler
How can I get the language of an Office installation? I need to add a new menu
item, but the captions are Office language dependent (File - English, Archivo -
Spanish, etc. )
Answer:
1 { ... }2 MsWord := CreateOleObject('Word.Basic');
3 try4 {Return Application Info. This call is the same for English and 5 French Microsoft Word.}6 Lang := MsWord.AppInfo(Integer(16));
7 except8 try9 {For German Microsoft Word the procedure name is translated}10 Lang := MsWord.AnwInfo(Integer(16));
11 except12 try13 {For Swedish Microsoft Word the procedure name is translated}14 Lang := MsWord.PrgmInfo(Integer(16));
15 except16 try17 {For Dutch Microsoft Word the procedure name is translated}18 Lang := MsWord.ToepasInfo(Integer(16));
19 except20 {If this procedure does not exist there is a different translation21 of Microsoft Word}22 ShowMessage('Microsoft Word version is not German, French, Dutch, Swedish
23 or English.'
24 Exit;
25 end;
26 end;
27 end;
28 end;
29 ShowMessage(Lang);
30 { ... }