I'm designing a set of related excel file which are related between them. The objective is that the macros which refere to each other document, can work in any given computer/path. For this reason I have used a set of relative path which lets the macros work well.
I have used the follwoing functions:
=+CELDA("nombrearchivo";$A$1)
"nombredearchivo"
means "filename"
in english.
The problem here is that this function only works when the computer is setup in Spanish, but when the files are transferred to a English set up computer, it translates de function CELDA to CELL, but not the "nombrearchivo".
To solve it I have thought about trying to show in cell the language in which Excel is setup and then write an if function with three main languages which would display the nombrearchivo, filename or the same in any other language.
Is it possible to show in a cell the language in which excel is setup??
The objective is that the macros ccan work at any given computer and path.
On the Review tab, in the Language group, click Language. Click Set Proofing Language. In the Language dialog box, select the Detect language automatically check box. Review the languages shown above the double line in the Mark selected text as list.
Click File > Options > Language. In the Set the Office Language Preferences dialog box, under Choose Display and Help Languages, choose the language that you want to use, and then select Set as Default.
The macros that you create in Excel would be written in the programming language VBA (Visual Basic for Applications). You will learn about the Excel macro code in later chapters. As you are aware, when there is an executable code, there is a threat of viruses.
The English name of that function is FORMULATEXT (please find the translated function name of your own language). This means that we can use this function to create our own way to detect a language. If you wnat to create an international sheet, it is a lot of work, but of you only need to support 2 or 3 languages, it can be used.
So we cannot request the language, however, from Excel 2016 and above, there is a possibility to get a formula in text. The English name of that function is FORMULATEXT (please find the translated function name of your own language).
Most Microsoft product that are legacy products tends to be written in C++ but as of late C-Sharp. The OS itself is written in C++. Originally Answered: What is used to write excel? MS Office was developed using assembler, then development moved to C, later, when C++ arose, everything new was done using C++.
Now select Language from the left option menu from the pop-up dialogue box opened. Now, search for the language in which you want to change the language of your Excel worksheet. Note: You will only find Languages in search, which are installed in your system.
This will return you a lang code go here to understand what LCID is..
And Here to get the list of all LCID code signification
for exemple : 1036 = French - Standard
dim lang_code as long
lang_code = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
Application.LanguageSettings Doc Here
This answer is totally extracted from this source:
https://www.mrexcel.com/forum/excel-questions/617870-language-code-french-spanish-spanish.html
So all credits go to original author Leith Ross:
' Written: March 01, 2012
' Author: Leith Ross
' Summary: Converts a Language Code Identifier (LCID) into the language name.
Private Declare Function GetLocaleInfoA _
Lib "kernel32.dll" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String, _
ByVal cch As Long) _
As Long
Function GetLanguageName(ByVal LCID As Long) As String
Const LOCALE_SENGLANGUAGE As Long = &H1001
Const LOCALE_SENGCOUNTRY As Long = &H1002
Dim Buffer As String
Dim BuffSize As Long
Dim RetVal As Long
BuffSize = GetLocaleInfoA(LCID, LOCALE_SENGLANGUAGE, 0, 0)
Buffer = String(BuffSize, Chr(0))
RetVal = GetLocaleInfoA(LCID, LOCALE_SENGLANGUAGE, Buffer, BuffSize)
If RetVal > 0 Then GetLanguageName = Left(Buffer, BuffSize - 1)
End Function
To test it, just type in a cell =GetLanguageName(1034)
(decimal value) but it works also with Hex value, like =GetLanguageName("&H40A")
I got this in my Excel:
And to get the decimal number you need to type, you can use something like this:
Function GetLanguage() As String
GetLanguage = GetLanguageName(Application.LanguageSettings.LanguageID(msoLanguageIDUI))
End Function
So typing in a cell GetLanguage()
will return the user's language.
Hope you can adapt this to your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With