VBA - capture ID of user with File Reservation, and then re-use in MSG box

Gerald Higgins

Well-known Member
Joined
Mar 26, 2007
Messages
9,115
Hi all - thanks in advance for any help.

I have an application which basically works fine, but I am looking at making some improvements.

One thing it does is try to work with other files held on network servers.

Occasionally, these files have already been opened by another user, and so the application is unable to open them in their read/write version, which is what I need.
I have got code which can get round this by either ignoring that type of error, or getting the application to fall over in a controlled way.

What I'd really like to do however (and am struggling with) is display a message to the user that the file is already in use, and include the other user's ID in that message, so that the person using my application can contact that person and get them to close the file. I think I could just use the standard message that Excel gives you in that situation, but I'd prefer not to, partly because that includes an option to open a read-only version, which I don't want the users to select.

The way I see this working, is that the application would (try to) open all the required files at the start of the task, and if it reached a problem with any of them it would display a clear message to the user, identifying the other user, and then shut down. IF all the required files were opened successfully, only then would it go on to perform the main tasks.

Any ideas on this ?

Thanks again in advance for any help.
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Watch MrExcel Video

Forum statistics

Threads
1,123,295
Messages
5,600,789
Members
414,405
Latest member
Zaurb

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
Top