Hallo,

I wrote a function to propagate the environment variable as recommended in the MSDN article Q104011

It worked fine. I could later on see the variable on the shell using set.

I wrote another function to get the environment variable. Curiously, I can get back the new propagated environment variable.

Code:
Dim strMyNewVar as String
Dim strVariable as String
Dim objWSH
Set objWSH = CreateObject("WScript.Shell")


strMyNewVar = “%MyNewVar%”

strVariable = objWSH.ExpandEnvironmentStrings(strVariable)
    
Debug.Print strVariable '(give nothing)

Am I doing something wrong?