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 Member Posts: 34
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 Member Posts: 8
    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.

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ___ < /> free ebooks and video tutorials about / Go PHP C++ C# Python JavaScript Perl MATLAB Swift Delphi Scratch Assembly R Ruby C PL/SQL Objective-C Visual Basic Visual Basic .NET Java Kotlin F# Scala ABAP Bash Dart ML Hack Fortran Clojure Scheme Crystal Alice Logo Lua Julia SAS COBOL Erlang Apex LabVIEW Rust Lisp Transact-SQL VBScript Prolog D FoxPro Awk Ada / _____________

Sign In or Register to comment.