none
Application.UserName VBA Excel 2010 Windows 10, doesn't see User Account RRS feed

  • Question

  • I have windows 10 and Excel 2010 instaled. 

    My user account in windows 10 is TomaRaja, but if I use the VBA macro below it gives mi back "Użytkownik systemu Windows" what can be translated as "Windows System User".  The problem is I have a bunch of files blocked by username and now I can't open them. Why excel doesn't see my user account? What should I do? 

        Range("M48:R51").Select
        ActiveCell.FormulaR1C1 = Application.UserName

    Monday, May 8, 2017 3:31 PM

Answers

  • Hello,

    Application.UserName is used to return and set the user name in Excel setting. 

    Please go to File -> Options -> General -> Personalize your copy of Microsoft Office check if the value in User Name is "Windows System User"

    If you want to get the current user account "TomaRaja" in win10, you could use Environ$("Username") 

    Regards,

    Celeste



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by tomaraja Tuesday, May 9, 2017 9:06 AM
    Tuesday, May 9, 2017 6:47 AM
    Moderator

All replies

  • Hi tomaraja,

    Thanks for visiting our forum. 

    Then this is the forum to discuss questions and feedback for Microsoft Excel. Since your issue is about using VBA macro in Excel, we'll move your question to the MSDN forum for Excel for better response:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Best regards,
    Yuki Sun


    Please remember to mark the replies as answers if they helped.

    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, May 9, 2017 6:25 AM
  • Hello,

    Application.UserName is used to return and set the user name in Excel setting. 

    Please go to File -> Options -> General -> Personalize your copy of Microsoft Office check if the value in User Name is "Windows System User"

    If you want to get the current user account "TomaRaja" in win10, you could use Environ$("Username") 

    Regards,

    Celeste



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by tomaraja Tuesday, May 9, 2017 9:06 AM
    Tuesday, May 9, 2017 6:47 AM
    Moderator
  • Thanks a lot. It helped.

    regards

    TomaRaja

    • Edited by tomaraja Tuesday, May 9, 2017 9:07 AM
    Tuesday, May 9, 2017 9:05 AM
  • Here's a number of ways to obtain different usernames from VBA:

    http://www.EXCELGAARD.dk/Lib/USERINFO/

    Tuesday, May 9, 2017 10:43 AM