我正在为我的公司制定一个软件规范,作为审计系统的一部分,我认为如果有一种方法可以抓住当前的Active Directory用户,那将是很好的.
希望像:
Dim strUser as String
strUser = ActiveDirectory.User()
MsgBox "Welcome back, " & strUser
Run Code Online (Sandbox Code Playgroud) 我通过谷歌找到了这个:http://www.mvps.org/access/api/api0008.htm
'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() …Run Code Online (Sandbox Code Playgroud) 我是Active Directory的新手.
我有一个VBA Excel加载项,当且仅当运行它的计算机当前登录到Active Directory时,无论是在本地还是通过VPN,都应该运行.
知道域名,我如何检索当前登录用户的用户名?
谢谢!