File In Use - reboot doesn't work

starl

Administrator
Joined
Aug 16, 2002
Messages
6,091
Office Version
  1. 365
Platform
  1. Windows
Have a program (stored on Desktop which is in the cloud) that opens a workbook (stored on a network). It's been working fine for years. It's a simple Workbooks.Open call.
Now, when the program tries to open the workbook, it gets a message that the file is already open. By the user who's trying to open it. Or, if you try on another pc, it says it's open by another user.
Have tried rebooting, clearing tmp files, made sure Excel was closed, opening the file manually (same error) - I cannot get the file unlocked.

Based on the setup - maybe it's not the user that needs to reboot but the server? Anyone know? Any other ideas?
I thought there were command lines that would force the release, but I don't remember them, nor can find the info.

fyi - user is in Windows 11, but has been for a while now.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Based on the setup - maybe it's not the user that needs to reboot but the server? Anyone know? Any other ideas?
Years ago, we had something like this happen a handful of times with an Access database. When an Access database is open, a "lock" is put on it (and you can see the locking file, i.e. for an "accdb", you would see a corresponding "lccdb"). Normally, when the user closes the database, the locking file would disappear. But sometimes we would have a "computer crash" or some other "abnormal close" of the database, that would leave the locking file open. The only way we could get rid of it was to do it from the server itself. It has been so long ago, I cannot remember if we were able to simply delete it, or if we needed to re-boot the server.

I know you are working with an Excel file and not an Access database, but I wonder if it is something similar, where you need to address it directly from the server.
What happens if you try to open it from the server? Does it still have the same issue?
If not, what if you try re-booting the server?
 
Upvote 0
If it's a server file lock, you'll probably need an admin to clear it, but it's worth checking the directory the workbook is in to see if there's a lock file there (the one starting with ~ before the file name) and trying to delete that if so. We have this periodically with some of our workbooks.
 
Upvote 0
There was an old tmp file in the working directory and I had deleted that, but it made no difference. It was also very old (2023), which I found strange.
Yes, looked for Excel as a background process. It was not.
As for opening the Excel file on the server itself - no, did not try. Not sure Excel is installed, but I'll tell them to reboot the server.

Even after creating a copy of the workbook and modifying the code to use the copy, it's happening again, same user.
Since I'm out of the office, instructing him to check for the ~.tmp file and, no matter what, reboot his pc & the server.
thanks
 
Upvote 0
The problem *appears* to have disappeared, but I'm still doing final tests (ie waiting)
A few more details
1. Both PCs are Windows 11, Office 365
2. Both PCs have the Desktop stored on OneDrive
3. Both PCs had the main workbook (program workbook) stored on the Desktop
4. The workbook the main workbook would open was stored on the "server"
5. The "server" is actually just an NAS drive
6. After moving the main workbook to the C: drive (local drive), the problem(s) went away
a. I do not know if the problems went away right away. I was sick and just provided instructions via email. I was told "still doesn't work" but when I got better and contacted them to desktop share and try things, everything was fine after moving the file to the local drive. It's possible that the files were moved, they checked, didn't work, but later rebooted- and then things were working when the temp files were released.

All I can say is I *really* do not like this default OneDrive Desktop configuration. It's havoc on code (which I've begun warning clients and integrating checks for) but also seems to generate other problems. I had searched for this being a possibility, but couldn't find anything. But my thoughts are that the Desktop was just not syncing correctly and cleaning up temp files. I don't know. And it doesn't make sense to me that OneDrive would be the problem because the file being opened was on the server - so wouldn't the temp file be there (I never saw it there...)

Note: I also have the main workbook opening & closing a connection to an Access database on the server - and last time I was there, I know I saw the temp file open, even though there wasn't anyone using it. So I'm definitely giving there OneDrive desktops the evil eye.
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top