Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing if file is open
Hi - Does anyone know of any code that will check if an xls is open, and if
it is, close it? Regards Andrew |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing if file is open
In the same instance of excel or open anywhere on a network?
On Error Resume next set bk = workbooks("ABCD.xls") On error goto 0 if not bk is nothing then bk.close SaveChanges:=False End if will do the first. http://support.microsoft.com?kbid=138621 XL: Macro Code to Check Whether a File Is Already Open http://support.microsoft.com?kbid=291295 XL2002: Macro Code to Check Whether a File Is Already Open http://support.microsoft.com?kbid=213383 XL2000: Macro Code to Check Whether a File Is Already Open http://support.microsoft.com?kbid=184982 WD97: VBA Function to Check If File or Document Is Open will find if it is open anywhere. closing it would be another story. Why not open it read only or make a copy or wait your turn. -- Regards, Tom Ogilvy "andreww" wrote in message ... Hi - Does anyone know of any code that will check if an xls is open, and if it is, close it? Regards Andrew |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing if file is open
Andrew,
Try something like On Error Resume Next Workbooks("BookName.xls").Close savechanges:= True ' or false On Error Goto 0 -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "andreww" wrote in message ... Hi - Does anyone know of any code that will check if an xls is open, and if it is, close it? Regards Andrew |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
testing. do not open. | Excel Worksheet Functions | |||
Testing for an open file | Excel Programming | |||
Testing if a file is open | Excel Programming | |||
Testing for a open worksheet from Outlook | Excel Programming | |||
Testing for open workbook | Excel Programming |