Identifying the username that is locking a file for editing

  • Re: Identifying the username that is locking a file for editing


    Thank you all for your replies. I've written time out code for wookbooks before. I also know how to retrieve the windows username in code. However I don't want to rely on code in the workbook being locked. The workbook is viewed by a large audience many of which don't enable macros. I know I can write code to "force" them to do so by hiding sheets etc etc.. Been there done that.



    I want the workbook that is being locked for editing to be void of macros. Just a plain old everyday spreadsheet with no VBA.


    What I would really like to do is write some code that I could put into a workbook that would prompt the user for the location of the file in question using the 'GetOpenFileName' method. Allow the user to point to any MS Spreadsheet. Then if the spreadsheet is locked for editing, display the windows user ID of the user who is locking it. If it is not locked for editing display a message stating so.


    I don't know where to start writing code that can read the userID remotely like this.

  • Re: Identifying the username that is locking a file for editing


    This sounds more like a network question than a VBA one. You are actually asking a question of the Network and not the file.


    I am sure that the Network admin could find out who has a network file open. You would therefore need to be able to access the Network file system and this would depend on your networking software.


    I doubt that VBA will be able to access this information without permission from your network administrator to link to a library of some sort.


    Good luck,


    Alan.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!