MS Access: Environ Function - learnit

Home Top Ad

Post Top Ad

Sunday, April 11, 2021

MS Access: Environ Function

MS Access: Environ Function

VBA Environ Function

VBA Environ function is categorized as an Information function in VBA. It is a built-in function in MS Office Excel VBA. This function returns value of the current operating system environment variable. It has one input parameter. It returns a string value. We can use this function only in VBA not as Excel function. This function can be used in either procedure or function in a VBA editor window in Excel. We can use this VBA Environ function any number of times in any number of procedures or functions. In the following section we learn what is the syntax and parameters of the Environ function, where we can use this VBA Environ function.


Syntax of VBA Environ Function

The syntax of the VBA Environ function is

Environ(Expression)


Parameters or Arguments

The Environ function has one input parameter or argument

Expression: It is a required parameter. The Expression is an argument that represents numeric number or variable name in the environment variable/string table


Where we can apply or use VBA Environ Function?

We can use this VBA Environ function in MS Office 365, MS Excel 2016, MS Excel 2013, 2011, Excel 2010, Excel 2007, Excel 2003, Excel 2016 for Mac, Excel 2011 for Mac, Excel Online, Excel for iPhone, Excel for iPad, Excel for Android tablets and Excel for Android Mobiles.

Example

Private Sub cmdEnviron_Click()
Debug.Print Environ("UserName")
Debug.Print Environ("ComputerName")
Debug.Print Environ("DriverData")
Debug.Print Environ("Password")
Dim commandstring As String
Dim i As Double
For i = 1 To 255
commandstring = Environ$(i)
Debug.Print commandstring
Next
End Sub

Please Watching My Video is Below

No comments:

Post a Comment

Post Top Ad