Consulting

Results 1 to 9 of 9

Thread: Solved: quick question

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    Solved: quick question

    Does anybody know where excel gets this info from:

    [VBA]Application.UserName
    [/VBA]

    because I use that in the page setup and I get an Administrator, while everyone else gets there name. And I am not an Administrator.

  2. #2
    VBAX Mentor CBrine's Avatar
    Joined
    Jun 2004
    Location
    Toronto, Canada
    Posts
    387
    Location
    Djblois,
    Ran a quick test and found that this is not the case.
    The most difficult errors to resolve are the one's you know you didn't make.


  3. #3
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    Thank you but where does Excel get the author field from?

  4. #4
    VBAX Mentor CBrine's Avatar
    Joined
    Jun 2004
    Location
    Toronto, Canada
    Posts
    387
    Location
    OK,
    Got it now.

    1. Select tools.....Options.
    2. Click on the general tab.
    The User Name field is what the code returns.

    Tested this time.

    HTH
    Cal
    The most difficult errors to resolve are the one's you know you didn't make.


  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It gets it from the value when you load Excel. If Excel is made available to everyone it is the name that the account is setup under, BUT ... it can easily be changed, it is stored in Tools>Options>General, in the Username box.

  6. #6
    VBAX Mentor CBrine's Avatar
    Joined
    Jun 2004
    Location
    Toronto, Canada
    Posts
    387
    Location
    Djblois,
    The options....User Name field is a global variable that I think feeds the author field.

    Cal
    The most difficult errors to resolve are the one's you know you didn't make.


  7. #7
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Tools/Options/General - Username
    changes it for me.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by CBrine
    Djblois,
    The options....User Name field is a global variable that I think feeds the author field.

    Cal
    I don't think so. Once setup when Excel is installed, it becomes an application property, and is only changed through the application.

  9. #9
    VBAX Mentor CBrine's Avatar
    Joined
    Jun 2004
    Location
    Toronto, Canada
    Posts
    387
    Location
    Is it included in the install? It's been so long, but I don't believe that you are prompted for that. I know the first time that an office app is run on a user profile, you are prompted for initials and user name. I think it's setup at that point, not at the install? Correct me if I wrong though(Which I know you will xld), cause I'm not positive.
    Although my terminology is wrong, you are right that it is a property, but isn't a property just a class variable.

    Cal
    The most difficult errors to resolve are the one's you know you didn't make.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •