环境VBA的功能代码示例 [英] Environ Function code samples for VBA
本文介绍了环境VBA的功能代码示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为VBA中的 Environ
函数寻找一些信息或代码示例,以获取当前系统上的用户名。
I am looking for some information or code samples for the Environ
Function in VBA to grab the username on the current system.
推荐答案
Environ()获取任何环境变量的值。可以通过在命令提示符中执行以下命令找到这些:
Environ() gets you the value of any environment variable. These can be found by doing the following command in the Command Prompt:
set
如果您想获取用户名,您可以:
If you wanted to get the username, you would do:
Environ("username")
如果您想获得完全限定名称,会做:
If you wanted to get the fully qualified name, you would do:
Environ("userdomain") & "\" & Environ("username")
这篇关于环境VBA的功能代码示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文