Re: Environment Variable Names
- From: "Chip Pearson" <chip@xxxxxxxxxxxx>
- Date: Thu, 20 Apr 2006 09:19:36 -0500
Run the following code. It will but the name of the environ
variable in column A and the value in column B.
Sub ListEnvioron()
Dim Rng As Range
Dim Ndx As Long
Dim S As String
Dim Pos As Long
Ndx = 1
On Error Resume Next
Set Rng = Range("A1")
Do While True
S = Environ(Ndx)
If Err.Number <> 0 Then
Exit Do
End If
Pos = InStr(1, S, "=")
Rng.Value = Left(S, Pos - 1)
Rng(1, 2).Value = Mid(S, Pos + 1)
Ndx = Ndx + 1
Set Rng = Rng(2, 1)
Loop
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Chaplain Doug" <ChaplainDoug@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:D99D7B3F-BC9D-4CF2-912A-E70089E4B2D4@xxxxxxxxxxxxxxxx
Excel 2003. I am using the Environ function to return the
"UserName"
environment variable (i.e., Environ("UserName")). Where would
I find a
listing of the other environment variables avaiable for use
with the Environ
function? Or put another way, what other environment variables
can I use
with the Environ function? Thanks and God bless.
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org
.
- Prev by Date: Re: Runtime error when closing the sheetHi all,
- Next by Date: Re: Difference between Excel 2002 and 2003?
- Previous by thread: Re: Removing unwanted space at end of text cell
- Next by thread: Conditional Formating another cell
- Index(es):