I have a bunch of Excel addins which are configured by an environment variable. Normally these are set in the registry on a system-wide basis. When I want change the value non-dynamically I go to:
my-computer -> properties -> advanced -> environment variables -> System variables
I have verified that when I set an environment variable here it seems to be picked up by Excel exactly as we might expect.
However, I also need to set environment variables dynamically, for example to make my Excel addin use an alternative configuration file. I'd expect to be able to do something like this:
set MYADDIN_CONFIG_FILE=path_to_config.xml
<path to excel>\excel.exe
Unfortunately when I do this it's as if the changes to the environment variables are completely ignored. I'm guessing that Excel needs to be told somehow notice environment variables which have been set form the command line?
I've verified that the above technique fails using the VB "Env" function.
FYI: Excel 2003 on Windows XP 32bit.