VBA Find the Windows username

Опубликовано: 15 Октябрь 2024
на канале: Simplified Excellence
612
5

Find the Windows username of your user.

Code:
Sub find_windows_username()

Dim windowsObject As Object
Dim username As String

'set object
Set windowsObject = CreateObject("WScript.Network")

'find username
username = windowsObject.username

'message
MsgBox ("The user is: " & username)

End Sub

-------------------------------
NEED HELP?
-------------------------------
Leave a comment with your questions, issues or projetcs and I will try to answer with a video.

-------------------------------
THANK YOU
-------------------------------
For watching my videos,
Your shares
And your comments!