(Solved) – Load windows environment variables

(solved)-–-load-windows-environment-variables

I have a sub that updated the windows environment variables based on user input. Can be done with either shell or WScript.

Shell "setx command"

or

Set objShell = CreateObject("WScript.Shell")
Set objEnv = objShell.Environment("USER")
objEnv("test") = new_env_var

Then I have other subs that would need to use the new environment variables. I would need to restart Excel in order to use these variables. Is it possible to load these variables without restarting Excel?

Leave a Reply

Your email address will not be published. Required fields are marked *