Hi,
I have a macro that opens a workbook. However, if the workbook is currently being used by another person, I would like to display a message to the effect that "the workbook is in use - please try later.", and preempt the standard messagebox that is shown "xxxx.xls is locked for editing by AN Other. Open 'Read-Only' or, click 'Notify' to open read-only and receive notification when the document is no longer in use."
Is there a way to query whether a workbook is in use before actually trying to open it?
This is the code as it stands:
Thanks in anticipation
John
I have a macro that opens a workbook. However, if the workbook is currently being used by another person, I would like to display a message to the effect that "the workbook is in use - please try later.", and preempt the standard messagebox that is shown "xxxx.xls is locked for editing by AN Other. Open 'Read-Only' or, click 'Notify' to open read-only and receive notification when the document is no longer in use."
Is there a way to query whether a workbook is in use before actually trying to open it?
This is the code as it stands:
Code:
Set wbMbr = Workbooks.Open("T:\Mbr.xls", 3, False))
If wbMbr.ReadOnly = True Then
MsgBox "Data is currently being maintained by another person. " _
& vbNewLine & vbNewLine _
& "Please try again later!", _
vbCritical, "Data maintenance"
wbMbr.Close savechanges:=False
Exit Sub
End If
Thanks in anticipation
John