Announcement Banner
UNSOLVED

Crosbylake

updated

20 years ago

C

Crosbylake

73 Posts

0

4164

September 14th, 2006 16:00

VB Excel

Can one access the name of the Computer Administrator from within Excel VB code?
How?
Thanks
CrosbyLake
  • abach

    1728 Posts

    426

    0

    Posted September 15th, 2006 19:00

    The User Name is set under Tools, Options, General tab. However, if you're trying to get the name of the person logged into Windows, you'll need the following code:
     
    Environ("USERNAME")
    You could create a function as follows:
     
    Function UserNameWindows() As String
        UserName = Environ("USERNAME")
    End Function

  • abach

    1728 Posts

    426

    0

    Posted September 15th, 2006 19:00

    If you want to get the name of the user, use
     
    application.UserName
     
    If you're trying to get someone else, let me know
  • Crosbylake

    73 Posts

    426

    0

    Posted September 15th, 2006 19:00

    Allan I tried that and it returned " " . I am looking for a way to access the screen account name.
    Thanks for your reply
    CrosbyLake
  • Crosbylake

    73 Posts

    426

    0

    Posted September 15th, 2006 20:00

    Allan that works great exactly what I'm looking for "Thanks Millions".
    Q. Where can I learn how use some of these capabilities of VB Excel?
    CrosbyLake
  • abach

    1728 Posts

    426

    0

    Posted September 16th, 2006 18:00

    There are a number of books that deal with Excel VBA. John Walkenbach has a very good book, as do other authors. Check out www.bookpool.com for ideas.