question about opening an excel-file

StefanH74

New Member
Joined
Jun 9, 2015
Messages
1
Hello,

not quite sure if this is an excel-setting or something on our network.
I have an excel-file, and I only want that to be able to be opened if it is not already in use by someone else.
normally when you would try to open a file that somebody else is already using, you would get the option to open it read-only, but I want that disabled (in some way).
so that if you try to open this file, and somebody else is already working in it, it would display a message stating that the file is already in use, and that you cannot open it until the other person closes it.
Hope you understand what I mean, and that somebody can help me with this

Thanx
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Place this in your "ThisWorkbook" object

Code:
Private Sub Workbook_Open()

If ActiveWorkbook.ReadOnly Then 
Msgbox "Workbook is in use. Please try again later.", vbokonly
ActiveWorkbook.Close False
End If


End Sub
 
Upvote 0

Forum statistics

Threads
1,203,667
Messages
6,056,649
Members
444,880
Latest member
Kinger1968

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