MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Checking For Open Files Including Path


Posted by Ken Brading on February 08, 2000 4:11 PM

I'm currently using the code listed below in a
host spreadsheet to check for open files.
Unfortunately it only checks the same directory
that contains the host spreadsheet even though I'm requesting
a different directory. How do I change the code
below for the host spreadsheet to look in other
directories?

Private Function WorkbookOpen(wbname) As Boolean
'Returns TRUE if the workbook is open
'This function needs to check the path as well as the workbook
Application.Volatile
On Error GoTo NotOpen
x = Workbooks(wbname).Name
WorkbookOpen = True
Exit Function
NotOpen:
WorkbookOpen = False
End Function


Ken Brading


Posted by Celia on February 09, 2000 4:22 AM


Ken
The following code returns the full path (even if the file is in a different directory).
Maybe it can be used in some way ?

“fullpath” = ActiveWorkbook.FullName

Celia

Posted by Ken Brading on February 09, 2000 10:44 AM

I'll experiment with it. Thank you.

Ken Brading