+ Reply to Thread
Results 1 to 9 of 9

Identify User who has a File Open

  1. #1
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Identify User who has a File Open

    I want to get a username who has a file already open. Is it possible by VBA?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Identify User who has a File Open

    Hi, Joakim N,

    maybe like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Identify User who has a File Open

    Thanks Holger. Works perfect.

  4. #4
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Identify User who has a File Open

    I've seen that code before, it shows you the owner of the document, not the user

    Gr
    Gerard

  5. #5
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Identify User who has a File Open

    OK. I tested on a document that I have created so the user and owner was the same. Any idea how to get the user?

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Identify User who has a File Open

    Hi, Joakim,

    if I open a file created by Hans W. Herber there is still my name being posted as user - is that what you asked for?

    @Gerard:
    it shows you the owner of the document, not the user
    security identifier

    (SID) A data structure of variable length that identifies user, group, and computer accounts. Every account on a network is issued a unique SID when the account is first created. Internal processes in Windows refer to an account's SID rather than the account's user or group name.
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx and from there http://msdn.microsoft.com/en-us/libr...identifier_gly
    Could you post where your information comes from, please?

    Ciao,
    Holger

  7. #7
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    232

    Re: Identify User who has a File Open

    Holger,
    I want to identify username of person who has the file open. It looks like the VBA-code identifies the creator/owner.

    I tested following:
    1. Opened a file created by another person than myself
    2. Executed the VBA code
    3. Returned was the creator of file. Here, I wanted that VBA should have returned myself.

  8. #8
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Identify User who has a File Open

    @HaHoBe:

    The functioncode is on several sites, for instands here.
    I was also in a search for a good code (for longer time), to return current user.....

    greetings
    Gerard

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Identify User who has a File Open

    Hi,

    Iīm unable to test the code I supplied right away on a network with other users (donīt have access from home gladly). Maybe try this function

    Please Login or Register  to view this content.
    returning Application.Username (not my favourite name to work with as TestUser isnīt really that unique for me to know who opened up the workbook).

    @Joakim N:
    Could you remove the Solved from this thread as we are still working on a solution at present. TIA.

    Ciao,
    Holger

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] User specified file open
    By AllenF in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-07-2014, 08:04 PM
  2. Replies: 12
    Last Post: 06-07-2011, 04:17 AM
  3. Get user name of an open file
    By Patfor7 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-17-2010, 02:03 PM
  4. identify to which user an excel document is open
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2009, 04:02 PM
  5. File is already open by user X
    By eagle13 in forum Excel General
    Replies: 1
    Last Post: 07-24-2006, 08:20 AM

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