Wednesday, 11 July 2012

How to get Office 365 username in a excel worksheet cell / Excel Function to get the username

You might require get application's username in order to user in your projects.

Since the arrival of Office 365, the office application's username became more valid where in older versions allowed user to edit the user name easily.


Add the below codes in a module of your project.

Public Function CurrentUser()
CurrentUser = Application.UserName
End Function


This function can be called from your worksheet or from a macro you have written.

But still there are lots of uses for this function in realtime. Like you can surprise the user by greeting him , etc.