Name
SetLocale Function
Syntax
SetLocale(lcid)lcidUse: Optional
Data Type: Long or String
A number representing a locale ID.
Return Value
A Long indicating the previous locale ID.
Description
Sets the current locale ID.
Rules at a Glance
A locale ID represents language as well as regional conventions. It determines such things as keyboard layout, alphabetic sort order, and date, time, number, and currency formats.
Appendix D lists valid locale IDs.
If SetLocale is called with no arguments, it resets the script locale back to the host default, which is usually the user default.
If
lcidis zero or 1024, the locale is set as defined by the user’s locale ID.If
lcidis 2048, the local is set as defined by the system’s regional settings.
Programming Tips and Gotchas
There is no need to call GetLocale and store its returned value before calling SetLocale, since SetLocale returns the value of the previous locale ID.
SetLocale sets the locale ID of the script engine only. It does not affect the system, user, or host/application locale IDs.
VBA/Script Differences
The SetLocale function is not supported by VBA.
See Also
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access