How to get Mail ID of Excel user - using VBA

Anonymous
2016-02-12T09:20:45+00:00

Hi All,

I want to get the Account information of Excel using , i.e When we click on "File" button which is top left side of Excel, we see something called "Account". In this "Account" we can see user mail id.

I want to capture user mail id using VBA.

Note: Application.Username will gives the system username which is not my requirement

This task is very important to me, your help in this regard highly appreciated

Regards,

Karthik

Microsoft 365 and Office | Excel | For home | Windows

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

6 answers

Sort by: Most helpful
  1. Andreas Killer 144K Reputation points Volunteer Moderator
    2016-02-13T04:12:40+00:00

    Hi Karthik,

    AFAIK this information is not available in the VBA Office Object Model structure.

    And you can not be sure to get this, cause not anybody is logged in:

    And it is also possible to use more then one service.

    But you can try to access the registry and enumerate all keys in this key:

    HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Identity\Identities

    Have also a look here:

    https://technet.microsoft.com/en-us/library/dn151329.aspx

    Andreas.

    0 comments No comments
  2. Anonymous
    2016-02-16T10:08:01+00:00

    Thanks Andreas

    Don't we have any alternative other than this. I mean using VBA ? 

    Regards,

    Karthik

    0 comments No comments
  3. Andreas Killer 144K Reputation points Volunteer Moderator
    2016-02-16T11:10:11+00:00

    Don't we have any alternative other than this. I mean using VBA ? 

    Counter question: Why do you need that?

    Andreas.

    0 comments No comments
  4. Anonymous
    2016-02-16T12:33:42+00:00

    Andreas,

    We have prepared one tool in Excel to our Architects/Project Managers, if they sign-in into Excel using Company credentials this tool should work otherwise (if they sign-in with into Excel with their personal id) it should not work.

    So capturing their mail id is the only option i have.

    Regards,

    Karthik

    0 comments No comments
  5. Andreas Killer 144K Reputation points Volunteer Moderator
    2016-02-16T13:56:05+00:00

    We have prepared one tool in Excel to our Architects/Project Managers, if they sign-in into Excel using Company credentials this tool should work otherwise (if they sign-in with into Excel with their personal id) it should not work.

    So capturing their mail id is the only option i have.

    Forget it! It is not possible to protect an Excel file with VBA in a safe way!

    Andreas.

    0 comments No comments