+ Reply to Thread
Results 1 to 13 of 13

Windows Login and date/time displayed in a cell

  1. #1
    Registered User
    Join Date
    06-27-2007
    Posts
    26

    Windows Login and date/time displayed in a cell

    Hi


    I need some vba code that will enable the users of my spreadsheet to populate a range of active cells with their Windows Username,time and date.

    Quite simply I have approx 30 people accessing one spreadsheet and each person needs to update some info on the page.. So what I want is a time stamp so i know at what time they finished their updates and will also confirm their usernames...

    Is this possible?

    Thanks

  2. #2
    Registered User
    Join Date
    01-16-2007
    Location
    Near the box
    Posts
    58
    Hi there,

    of course it's possible. To achieve this you must call some system API function.

    Name

    So let's say we want to get the current logged (on win box) user:

    Please Login or Register  to view this content.
    Excel object Application provides username too via Application.UserName. But both of these names can vary. Application.name is name of the registered user of the M$ Excel.

    Time

    To get the correct time use Excel Time and Date function.

    Now you can simply use auto_open sub for log-in process and auto_close sub for log-out process.

    For example:

    Please Login or Register  to view this content.
    Have fun !
    Attached Files Attached Files
    Last edited by bettatronic; 08-09-2007 at 01:40 PM.
    ? ? ? I like the way how Excel can access system API. Really cool ! ? ? ?

  3. #3
    Registered User
    Join Date
    06-27-2007
    Posts
    26
    thank you very much...

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    For windows login Id you could use

    Please Login or Register  to view this content.
    In leui of the GetUserName function
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    For Date & Time alternative

    Please Login or Register  to view this content.
    Bettatronic, I have noticed in a few of your posts you declare an Integer for Row number, this could be a problem if the Row Number exceeds the limitation of an Integer (–32,768 to 32,767), especially with 2007, I would always use a Long.
    Last edited by royUK; 08-10-2007 at 10:37 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    01-16-2007
    Location
    Near the box
    Posts
    58
    Quote Originally Posted by royUK
    For Date & Time alternative

    Please Login or Register  to view this content.
    Bettatronic, I have noticed in a few of your posts you declare an Integer for Row number, this could be a problem if the Row Number exceeds the limitation of an Integer (–32,768 to 32,767), especially with 2007, I would always use a Long.
    THX royUK for info about the Integer. Now I'm going to use the long instead.

  7. #7
    Registered User
    Join Date
    06-27-2007
    Posts
    26
    How about this?? If column D = 100% I want the the Username, date and time to be recorded in column E

    For example:


    8 0 0%
    4 0 0%
    6 0 0%
    32 32 100% Windows login Completed at 08:40:56 on 13/8/2007
    17 4 24%
    1 1 100% Windows login Completed at 08:39:56 on 13/8/2007

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Adapt som code to loop through Column D & check for 100%, then use the code provided.

  9. #9
    Registered User
    Join Date
    06-27-2007
    Posts
    26
    Quote Originally Posted by royUK
    Adapt som code to loop through Column D & check for 100%, then use the code provided.

    i would love to if i knew how... hence the reason i am asking...

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I don't really know what will determine 100%, will there be only one instance of 100%?

  11. #11
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi bettatronic,

    I've been trying to find an API to display the username(windows login) in excel. Thanks for this info.

    Do you have a site that provides a complete API in excel?

    Thanks in advance.
    Corine

  12. #12
    Registered User
    Join Date
    06-27-2007
    Posts
    26
    Quote Originally Posted by royUK
    I don't really know what will determine 100%, will there be only one instance of 100%?

    I have attached the spreadsheet for more clarity...


    Column B shows the total by User.. Column C shows how many have been signed... Column D shows the % signed... I would like the relevant cell inColumn E to show the login Name, Date and time when the cell in Column D goes to 100%...

    Does that help at all???

    Thanks for your help by the way...
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    06-27-2007
    Posts
    26
    any ideas on this one???

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1