if anybody is still interested, I found a way to get a Windows environment variable into an Excel spreadsheet.
1. In Excel, choose Tools, Macro, Visual Basic Editor
2. Add a module (You can see an example in the pic) which uses the VBA Environ function.
Function Name() As String
Name = Environ("VARIABLENAME")
End Function
3. Go back to the spreadsheet and be in the cell where you want the variable to appear
4. Choose Insert, Function, then select category "User Defined", and select the module you created. Click OK.
5. You should see the value displayed.
6. Save spreadsheet.
Note: The environment variable must be the "permanent" kind, such as TEMP, USERNAME, Windir, etc, OR the sort you set in My Computer, Advanced, Environment Variables, or by using Control Panel->System->Advanced Tab->Environment Variable Button, or with a command line tool such as setx (Windows 2000 Resource Kit). You may need to log out & in again to see the new variable in Excel.
In the command window you can see, I had typed SET (with no arguments) to display the environment variables and their values.