I'm trying to have the current date recognized in Excel using an =TEXT(TODAY(),"mmmm d yyyy") function, but I have run into issues with Canadian users based in Quebec, who may have a system install set to English or French, and likewise an Office install in one language or the other. For today's date, my spreadsheet pulls March 10 2021 on my computer, but the result has been askew for each Quebec-based user I have tested with.
In order to resolve this, I set up a VBA function to pull the application's language setting, with the intention to use a simple IF to check the language code and change from "mmmm d yyyy" to "mmmm j aaaa" (the letters to match the French journée for day and année for year, as per consulting the formats available on French Excel's TEXTE function). My function worked... but the output has come back incorrect each time.
Public Function LangCheck()
Dim lang_code As Long
lang_code = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
LangCheck = lang_code
End Function
So that did its job, but the outputs should have been March 10 2021 or mars 10 2021. Instead from two different users I have received:
March j Wednesday, from a user with a French Excel setting, confirmed by the code outputting language ID 1036.
mars d yyyy, from a user with an English Excel setting on a French OS, confirmed by the code outputting language ID 1033.
Excel is translating every function to its French cognate, but won't translate the formats for the TEXT function on its own. Does anyone have a suggestion for a VBA or function-based solve to this conundrum so that I can ensure consistent dates return regardless of language?