If you want to extract Domain name and User name you can use below code,
Dim strDomain As String
'Extract domain name and username
strDomain = System.Security.Principal.WindowsIdentity.GetCurrent.Name
MsgBox(strDomain)
'Extract domain name from full login
strDomain = Mid(strDomain, 1, InStr(strDomain, "\") - 1)
MsgBox(strDomain)
No comments:
Post a Comment