Name
SetLocale Function
Syntax
SetLocale(lcid
)
lcid
Use: 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
lcid
is zero or 1024, the locale is set as defined by the user’s locale ID.If
lcid
is 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
Get VBScript in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.