Hi

I've entered the below code in my workbook, and it's working perfectly. However I hadn't considered that some of the files that the code opens, update and save could already be open by another user on the network.

But I can't figure out how to adjust my code so it doesn't update already opened files? And at the same time I would like a msgbox so popup and tell the user that, file XXX hasn't been updated.

Is this possible?

Private Sub Workbook_Open()

Todaysdate = Date
Worksheets("Dates").Range("C4").Value = Todaysdate

MsgBox "The report is being updated, click ok and wait", vbExclamation

    Dim MyPath          As String
    Dim MyFile          As String
    Dim Wkb             As Workbook
    Dim Cnt             As Long
    
    Application.ScreenUpdating = False
    
    MyPath = "F:\MS_DOK\........\" 
    
    If Right(MyPath, 1) <> "\" Then MyPath = MyPath & "\"
    
    MyFile = Dir(MyPath & "*.xlsm")
    
    Cnt = 0
    Do While Len(MyFile) > 0
        Cnt = Cnt + 1
        Set Wkb = Workbooks.Open(MyPath & MyFile)
        Wkb.Close SaveChanges:=True
        'Wkb.Worksheets("Sheet1").Range("B7").Value = "MyNewValue"
        'Wkb.Close savechanges:=True
        MyFile = Dir
    Loop
    
    If Cnt > 0 Then
        MsgBox "Updating has been completed", vbExclamation
    Else
        MsgBox "No files were found!", vbExclamation
    End If
    
    Application.ScreenUpdating = True
End Sub
I appreciate all the help I can get

Thanks