Results 1 to 4 of 4

Thread: "This file is locked. Try the command again later" message in a shared excel document

  1. #1
    Join Date
    Dec 2011
    Posts
    59

    "This file is locked. Try the command again later" message in a shared excel document

    I am new to the Excel and I don’t have much information about this Excel application. I am getting one error massage "This file is locked. Try the command again later" for a spreadsheet that is shared to multiple people in multiple offices. They all go into the sheet at random times to edit but many are getting the same error message. Can someone explain why we get this message and how do I fix or avoid getting this in the future?

  2. #2
    Join Date
    Aug 2011
    Posts
    566

    re: "This file is locked. Try the command again later" message in a shared excel document

    According to my information this is not an error or something like that, this is one of the information message that you receive when you try to save or close a shared file. The file gets saved anyways.

  3. #3
    Join Date
    Apr 2008
    Posts
    4,088

    Re: "This file is locked. Try the command again later" message in a shared excel document

    You should try to close the file in Quick View before you try to save the shared workbook. If this doesnt work then another user might have opened the Shared Workbook so wait for sometime and save the file again. Usually the number of minutes to wait generally depends on the size of the file and how long it takes to open the file. For more information visit this website - http://support.microsoft.com/kb/129276

  4. #4
    Join Date
    Nov 2009
    Posts
    351

    Re: "This file is locked. Try the command again later" message in a shared excel document

    Can you try to add the below function in a VBE module:

    Code:
    Function IsFileLocked(filePath As String) As Boolean 
        On Error Resume Next 
        Open filePath For Binary Access Read Write Lock Read Write As #1 
        Close #1 
        If Err.Number <> 0 Then 
            IsFileLocked = True 
            Application.StatusBar = "Waiting for file to close" 
            Err.Clear 
        Else 
            IsFileLocked = False 
            Application.StatusBar = "" 
        End If 
    End Function
    And after that you should also add the below in the workbook module:

    Code:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 
        Dim fName As String 
        fName = "your file name" 'file name goes here
        If IsFileLocked(fName) Then 
            MsgBox ("File is locked" & vbCrLf & "Please try again later") 
            Cancel = True 
        End If 
    End Sub

Similar Threads

  1. Replies: 5
    Last Post: 23-03-2011, 10:31 AM
  2. Error "document not saved" when saving Excel sheets
    By BansiJ in forum Windows Software
    Replies: 3
    Last Post: 31-07-2010, 03:07 PM
  3. Error Message "Word found locked fields during update"
    By Balamani in forum Windows Software
    Replies: 3
    Last Post: 21-10-2009, 05:36 PM
  4. message "xls is locked for editing by ---" accessing excel workbook
    By Alleysdad101 in forum MS Office Support
    Replies: 8
    Last Post: 24-07-2008, 10:03 PM
  5. Replies: 2
    Last Post: 17-01-2007, 09:47 PM

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
  •  
Page generated in 1,716,046,703.81003 seconds with 18 queries