Retrieve Office 365 User Name - Excel VBA

Anonymous
2017-06-12T11:59:02+00:00

Hi. I'm wondering if it is possible to get the name of the user that is currently signed in to Excel using VBA?

In my case, this is the user name of the Office 365 account that is currently signed in.

In Excel 2016, File > Account > User Information

Microsoft 365 and Office | Excel | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2017-06-20T03:34:50+00:00

    Hi Tswar,

    Based on my research, I didn't find any VBA code can achieve it. Any community members who have related experience are welcome to share your insights here.

    If you want to check the accounts signed into Excel, you may go to File>Account>Switch account> Check the Current Account and Other Account section.

    Regards,

    Felix

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-06-12T12:56:47+00:00

    Try one of these

    best wishes

    Function who()

     who = Application.UserName

    End Function

    Function whome()

     whome = Environ("username")

    End Function

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2017-06-12T20:53:20+00:00

    Hi Bernard,

    Thanks for your response, I am after the signed in user for Office 365 which differs from the Application.Username or Environ("username"), see below image. Is there a way to retrieve this using VBA?

    0 comments No comments