Running Excel in a different locale/Change system locale settings

I'm trying to find a way to change the locale settings when opening Excel, or changing the entire system locale settings. I know it's bad practice to do this, so I'll just note that this is purely for automated testing reasons. We want to run our Excel add-in simulating multiple different locale settings to make sure it's handling all the functions properly (if there's a better way of doing this than changing settings please let me know!)

I know how to change the CurrentCulture of the thread, but that only seems to apply to our add-in, so functions of Excel called by our add-in run with the system locale settings.

There are 3 ways I've found that I thought might get this working, but one of them seems like an insanely bad idea, and the other two I can't manage to get working:

  • The really bad one was to import a .reg file in to the system registry before opening Excel, but I don't like the idea of this.
  • Another way seems to be to use SetLocaleInfo, imported from kernel32.dll, but for the life of me I can't figure out the parameters to use, or even if this is what I need.
  • The last way was to use Microsofts AppLocale tool, but opening it through that with different language settings didn't seem to achieve what I expected. Actually, it didn't seem to change anything at all from my current system settings!

If anyone can provide any help it would be greatly appreciated, otherwise I guess these are just being left as manual tests!


Here you have a full example of how to call SetLocaleInfo from .Net. I won't copy here for brevity, it's a

I would suggest creating several users on your computer and adjusting user locale settings accordingly to your test purposes for each user in Control Panel -> Region and Language. This basically allows setting a default language, and currency/number/date/time formats. If this is what you want, you can launch excel using a different user execution context by either runas command, which requires a manual password entering, or in batch mode using psexec tool from SysInternals:

Make sure to specifycommand line options that load account's profile. Unfortumnately you can only adjust user locale settings per each user. System locale settings are defined per computer.

Need Your Help

Call a custom method in linq query

c# linq entity-framework linq-to-sql

I need to call a custom method in linq query, e.g.:

How to Secure Spring Rest Services with Spring Sercurity and Angularjs?

angularjs rest authentication spring-mvc spring-security

I have a Spring MVC Server Backend with Rest-Services and an AngularJS WebFrontend.