Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

environment variables set when Excel already open

Status
Not open for further replies.

christhedonstar

Programmer
Apr 9, 2007
215
GB
Hi,

If I open Excel and then create an environment variable on my computer, I cannot see that environment variable when I use environ("myEnvironmentVariable"). Also cannot see it if I use the WScript.Shell.ExpandEnvironmentStrings("%" & myEnvironmentVariable & "%") function.

I only can see it if I restart Excel and run those functions. Is there anyway to get the variable value without restarting Excel?

Thanks in advance,

Chris
 
and then create an environment variable
How do you create the environment variable ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
With c# process that is shelled out to when the workbook opens in Excel. If I open up a new command prompt and type "set" then I'll see the environment variable.

Thanks,

Chris
 
Perhaps its not possible? I'm starting to get the feeling as I've spent a while searching for the answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top