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