Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi John
use the following formula to check for an open workbook: Function IsWorkbookOpen(Name As String) Dim WB As Workbook On Error Resume Next Set WB = Workbooks(Name) On Error GoTo 0 IsWorkbookOpen = Not (WB Is Nothing) End Function so you can then use the following Sub Check_WB() If IsWorkbookOpen("Book1.xls") Then Workbooks("Book1.xls").Close Else Workbooks.Open Filename:="D:\temp\Book1.xls" End If End Sub HTH Frank John Baker wrote: HI: I would like to test if a specific file is open, and if it is I want to close it. Can someone tell me the expression to use to deterine is a file (say collector.xls) is open? Thank you John Baker |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. | Setting up and Configuration of Excel | |||
In Excel - Use Windows Explorer instead of File Open to open file | Excel Discussion (Misc queries) | |||
testing. do not open. | Excel Worksheet Functions | |||
Testing for a open worksheet from Outlook | Excel Programming | |||
Testing for open workbook | Excel Programming |