Excel vba find who has file open


















Many times, when I open these files, excel says there is "another user" that has the file open. However no one has it open because I literally save, close and reopen the file in a matter of seconds and that message shows up. In addition, when someone else does have it open, it will tell me the username of the person, or their PC number, so I know for a fact they actually have it open. I was told that the issue occurs because the files are not "closed properly" and so excel still thinks someone has it open??

There is only one related article to explain a similar error message on Word. Here it is "The document is locked for editing by another user" error message when you try to open a document in Word. The useful information from my respective is Word creates an owner file when you open a previously saved Word document.

An owner file is temporary and holds the logon name of the person who opens the document. FileSystemObject" fso. I do not know if this also works with shared excel sheets. Luuk Luuk 6, 3 3 gold badges 17 17 silver badges 24 24 bronze badges. Thank you for the solution!

I don't know why you think you are bad at writing macro's, because the code you provided works perfectly. Some tips: Try to add some comments or at least explain what you do in your code, now I had to do some research and still don't understand everything a lot.

Where and how did you find that? Also try not to use short variables like "x, y, i" but give them a decent name. The above will help everyone in reading and understanding the code. Why Mid x, 2, Asc x Because i need something on the second position of the x i did read. The biggest problem with this macro is not the lack of my comments, but the lack of documentation about the internal format of a tempfile created by Excel. Do you have any idea what the cause could be?

If tempfile was the problem an error should have been thrown much earlier I think. Maybe that's the problem? But then again, why does it work most of the time, but only a few times it doesn't?

Click here to reveal answer. ScottR Well-known Member. Joined Apr 17, Messages It's basically not possible without administrative rights and extensive use of windows api calls as there is nothing in Excel that holds this information. Hello, I will maybe try it, but my excel vba level is basic so this is hard for me. I have administrative right, but VBnet is different league.

Do you know any code for open file and when is read only msgbox show you who is actually in file? I fond any getusername, but I don't know how use it. AkaTrouble Well-known Member. Joined Dec 17, Messages 1, You must log in or register to reply here.

Similar threads U. Replies 3 Views Nov 30, uk Question Check for file needed that will be in 1 of 2 locations. Replies 16 Views If they don't need it open any more, you can right click on it there and click Close Session and that one file will be closed for that one user.

I believe you can see what users ahev what files open by using Computer management on the server:. I have tried Computer Management, but maybe I have something mis-configured as I do not see what I am looking for. The server has two physical HDs - the local disk C: and another disk F: I have tested opening files on both drives, and none of the files show. The Shared directories the files are in do show under Shares, but nothing under Sessions or Open files.

Edit: BTW, the users use terminal services to connect to the same server. They are not mapped to the drives from workstations. And it seems we both missed the second paragraph of Steve's question. He's already looked in there and dosen't see them?? Tho I did notice in a test I did that the open files showed up just after they were opened but not some 5 minutes later. Maybe there is some time limit on how long they show? I am using the Computer Mgmt on the server in question.

Downloaded and tried. Works for what I need and then some! Thanks to all three of you for your input!



0コメント

  • 1000 / 1000