Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Robert Richardson   on Oct 28 In MS Office Category.

  
Question Answered By: Cais Nguyen   on Oct 28

userdomain is an environ element... try this and you can see what items you can
get from the environ... (modified from the help example

Sub environstring()

Dim EnvString, Indx, Msg, PathLen ' Declare variables.
Indx = 1 ' Initialize index to 1.
Do
EnvString = Environ(Indx) ' Get environment
' variable.
If Left(EnvString, 5) = "PATH=" Then ' Check PATH entry.
PathLen = Len(Environ("PATH")) ' Get length.
ThisWorkbook.Worksheets("sheet2").Range("A" & Indx).Value = EnvString
' Msg = "PATH entry = " & Indx & " and length = " & PathLen
' Exit Do
Else
Indx = Indx + 1 ' Not PATH entry,
ThisWorkbook.Worksheets("sheet2").Range("A" & Indx).Value = EnvString
End If ' so increment.
Loop Until EnvString = ""
If PathLen > 0 Then
MsgBox Msg ' Display message.
Else
MsgBox "No PATH environment variable exists."
End If

End Sub

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Domain Name Or get search suggestion and latest updates.


Tagged: