This FAQ is simply some code to show all the current environment variables for the current excel session. Environment variables can be used to test for users, homedrives, no. of processors and domains amoungst other things. It works on windows only (sorry mac users) and I use it most often to obtain the network userid of the current user. This is especially useful where you have different types of access depending on who the user is.
This code will show all the environment variables:
Sub List_Environment_Variables()
Dim EnvString As String
Indx = 1
Do
EnvString = Environ(Indx)
Cells(Indx, 1) = EnvString
Indx = Indx + 1
Loop Until EnvString = ""
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.