ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prevent two network users from opening same workbook? (https://www.excelbanter.com/excel-programming/388855-prevent-two-network-users-opening-same-workbook.html)

Ed

Prevent two network users from opening same workbook?
 
If a workbook is already open and a user tries to open it across a
network connection, they get the "Read Only / Notify" dialog. Is
there a convenient way to detect that one user already has the
workbook open, and prevent a second user from opening the file at all,
not even as Read Only?

Ed


John.Greenan

Prevent two network users from opening same workbook?
 
There is no "convenient way" to do this. It can be done but is not
convenient as it requres using Windows API calls and a lot of faffing about.


--
http://www.alignment-systems.com


"Ed" wrote:

If a workbook is already open and a user tries to open it across a
network connection, they get the "Read Only / Notify" dialog. Is
there a convenient way to detect that one user already has the
workbook open, and prevent a second user from opening the file at all,
not even as Read Only?

Ed



NickHK

Prevent two network users from opening same workbook?
 
Ed,
You can add code to workbook's Open event and see if its .ReadOnly property
is true.
Then put up a msgbox and .Close.

However, if the user disables macros/events, then this will not function.
Or if the user actually wants it open as ReadOnly.

NickHK

"Ed" wrote in message
ups.com...
If a workbook is already open and a user tries to open it across a
network connection, they get the "Read Only / Notify" dialog. Is
there a convenient way to detect that one user already has the
workbook open, and prevent a second user from opening the file at all,
not even as Read Only?

Ed






All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com