Detect if file is open

  • Thread starter Thread starter Chad
  • Start date Start date
C

Chad

Is there a method to detect if a file is already in use by someone, before I
open it?

Chad
 
Just use this function:

Function IsWorkbookOpen(WorkbookName as String) As Boolean
Dim Wkb as Workbook
on error resume next
Set Wkb = Workbooks(WorkbookName)
If Not Wkb Is Nothing Then IsWorkbookOpen = True
End Function


Just have to pass the workbook name to the function...if
it is open, it will return TRUE, if it is closed, FALSE

Seth
 
Back
Top