+ Reply to Thread
Results 1 to 4 of 4

Excel 2010 - Who is locking the file?

Hybrid View

Orson100 Excel 2010 - Who is locking... 05-17-2010, 09:20 AM
Orson100 Re: Excel 2010 - Who is... 05-17-2010, 05:27 PM
dominicb Re: Excel 2010 - Who is... 05-17-2010, 07:11 PM
Orson100 Re: Excel 2010 - Who is... 05-18-2010, 05:38 AM
  1. #1
    Registered User
    Join Date
    04-16-2009
    Location
    Kilkenny, Ireland.
    MS-Off Ver
    Excel 365
    Posts
    47

    Re: Excel 2010 - Who is locking the file?

    Ok, so my first question is pretty easily sorted by checking activeworkbook.readonly status.

    Please anybody got any advice on how I can find out who has write access to the file?

    Orson.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Excel 2010 - Who is locking the file?

    Good evening Orson100

    I saw your post earlier, and as I don't have Excel 2010 I'm probably not the best person to answer, but ...

    Ivan F Moala has a couple of routines here that should help out. However, he gives two options to do it ; a VBA method and an API method. With Excel 2010 you would need to avoid the API method - I won't go into why, I'll just tell you now it almost certainly won't work. There should be no reason why the VBA method would fail.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    04-16-2009
    Location
    Kilkenny, Ireland.
    MS-Off Ver
    Excel 365
    Posts
    47

    Re: Excel 2010 - Who is locking the file?

    Dominic,

    Thanks for the references. However, due to a particularly bad episode of brain freeze on my part, this is all redundant.

    In addition to migrating from XL07 to XL10 I am also porting to a new server environment and guess what.. I forgot to set write permissions for the users So my belief that the "this file is locked for editing by [etc]" message had been dropped in XL10 is completely wrong, File access was defaulting straight to R/O mode by virtue of the permissions at server level only. The message is still there.

    Sorry all for this confusion.

    By the time I had realised this, I had already cobbled together a wheel re-invention from various sources as below, which might be useful if one wishes to re-display the current (or more correctly, last-known) write-access user details during an active Excel session or something I don't know...

    Sorry again for the incorrect steer and thanks for the advice.

    Regards
    Orson.


    
    Private Sub Workbook_Open()
    
    'Wheel Re-invention
    
    'If workbook is opened in write mode, save the current
    'user data to a sheet in the workbook
    
    If ActiveWorkbook.ReadOnly = False Then
    
        Users = ActiveWorkbook.UserStatus
    
        With Sheets("User")
            
            For Row = 1 To UBound(Users, 1)
            .Cells(Row, 1) = Users(Row, 1)
            .Cells(Row, 2) = Users(Row, 2)
            Next
    
        End With
    
        ' For the benefit of the next person to access, the
        ' current user data on sheet User must be saved to workbook file
        
        ActiveWorkbook.Save
    
    End If
    
    'If workbook is opened in readonly mode, display the user who has
    'current write access (include date and time of access if desired @ user!b2 )
    
    If ActiveWorkbook.ReadOnly = True Then
                
                MsgBox "You are in Read Only Mode. This Workbook is being edited by " _
                & Sheets("User").Range("a1")
    
    End If
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1