Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checking if workbook open (where path is unknown)
If bIsBookOpen("abc.xls") Then
MsgBox "FOUND " & "abc.xls" End If Public Function bIsBookOpen(ByRef szBookName As String) As Boolean '' Checks to see whether a WorkBook is open. On Error Resume Next bIsBookOpen = (Len(Workbooks(szBookName).Name) 0) End Function HTH Paul -------------------------------------------------------------------------------------------------------------- Be advised to back up your WorkBook before attempting to make changes. -------------------------------------------------------------------------------------------------------------- On 4 Sep 2003 14:00:37 -0700, (Alan) wrote: I need to check if a workbook is open but the user may have changed the path. The workbook I want to test for is called abc.xls and contains a specific customised (password-protected) code. I want to test, from def.xls, if abc.xls is open. The user may have changed the path (and even the name) of abc.xls, so I can't check is C:\some path\abc.xls is open. How do I do this? The pseudo code might be: For each open workbook in any instance of Excel Check for presence of code If code found then msgbox "FOUND" exit for Next workbook I am using Excel 2000. TIA Alan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to see full path name of open workbook? | Excel Discussion (Misc queries) | |||
How to find file-path of open workbook? | Excel Discussion (Misc queries) | |||
Macro to open Workbook in default path. | Excel Discussion (Misc queries) | |||
Checking for Open Workbook | Excel Programming | |||
checking if workbook is open before accessing | Excel Programming |