VBA has an Environ function that can be useful for getting things out of the... environment
It's basic use is like this: