Read Only Problem - Excel - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Read Only Problem - Excel

spike2907spike2907 Posts: 34Member
I have the following code which opens a spreadsheet and writes to it. If the spreadsheet is already in use by someone else then it throws up a message box and stops the macro.

Is it possible to pick up which user has the docuement open so I can ring them and tell them to get out! I have tried the Application.UserName property but this just returns my name!!!

Sub Tracking_System_open()


If Workbooks("Tracking_system").ReadOnly = True Then
MsgBox ("The Workbook is already open by ..........")
End If

End Sub



  • SanganakSakhaSanganakSakha Posts: 8Member
    Hello spike2907,

    As far as I know, this problem is outside the scope of Excel. Only the network operating system can know which particular file on the network is being accessed and by whom.

    I believe you will need to use an API (Application Programming interface) function to find this out.

    A WINDOWS OS programming expert might be able to tell which particular API might be able to do so and how to use it.
    You can incorporate this API function into the Excel VBA code.

    I would be glad to provide any more help you may need in this regard.

    with best compliments,

    Your Friend In Need.

Sign In or Register to comment.