I have this code to determine if a workbook is already open but having trouble figuring out to have it wait 5 seconds and try again and if after 3 tries then send the msgBox database is in use.
If wBook.ReadOnly = True Then
MsgBox "Database is in use. Please try after sometimes.", vbookonly + vbCritical, "error"
Exit Sub
End If
If wBook.ReadOnly = True Then
MsgBox "Database is in use. Please try after sometimes.", vbookonly + vbCritical, "error"
Exit Sub
End If