Detect if file is open

C

Chad

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

Chad
 
S

Seth

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top