简体   繁体   English

UserName = Environ $(“UserName”)在最新版本的Windows中不起作用?

[英]UserName = Environ$(“UserName”) not working in latest versions of Windows?

This code does not appear to work in Windows 7/8? 此代码似乎不适用于Windows 7/8?

Public Function UserName()
    UserName = Environ$("UserName")
End Function

Is there a hack for this? 这有什么黑客攻击吗?

Regards, 问候,

我用:

Username = CreateObject("WScript.Network").Username

This works for me on Windows7 using Excel 2010. 这适用于使用Excel 2010的Windows7。

Environ("username")

用户名而UserName2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM