Suppress Read-only and notify message box

newvbie

Board Regular
Joined
Mar 18, 2006
Messages
69
Hi there. Can I use vba to suppress the "read-only ,notify, cancel" message box when the read only file (which is being opened by other user) is opened by a another user? I want a tailor-made message box is used instead.

Cheers.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Application.DisplayAlerts = False

might work for you

if you put it in the This Workbook

module to run on start up and then turn it to True upon close

ive not tested this but im confident it should wok

Stu
 
Upvote 0
Hi there. Thanks for your reply. However, I have tried your advice but the message box still pops up if the file is opened by someone. I placed the expression in the thisworkbook module as follows:

Code:
Private Sub Workbook_Open()
    Dim sUserName As String
    Application.DisplayAlerts = False
If ActiveWorkbook.ReadOnly Then
sUserName = "[ " & Sheet2.Range("bd4").Value & " ]"

sMsg2 = "Sorry!  This leave plan is now being used by " & vbCrLf
sMsg3 = vbCrLf & "  ....Please try again minutes later..."
        MsgBox sMsg2 & vbCrLf & "           " & sUserName & vbCrLf & sMsg3, vbCritical, "Filed being used"
     Application.Quit
    ActiveWorkbook.Close
    Application.DisplayAlerts = True
    Exit Sub
endIf

Any advice?

Cheers.
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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