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!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.