Saturday, March 18, 2017

Excel VBA function- Environ function


By Ajeet Kumar

VBA ENVIRON Function

This function is passed an environment variable name in string form or the index value of the variable. This function returns the value of that environment variable.

Their are two forms of this function:

1. Environ()

2. Environ$()



Sub EnvironFun()
Dim i
    For i = 1 To 50
        Range("A" & i).Value = Environ(i)
    Next
    Debug.Print Environ$("TEMP")
End Sub

No comments:

Post a Comment

Hot Topics