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
Should give you what you want.
--
Regards,
Tom Ogilvy
flashpoint wrote in message
...
On Fri, 15 Aug 2003 13:08:52 -0400, "Tom Ogilvy"
wrote:
Dim bk as workbook
On Error Resume Next
set bk = WorkBooks("ws2.xls")
On Error goto 0
if not bk is nothing then
msgbox "ws2.xls is open"
else
set bk = workbooks.open( Filename:="c:\ws2.xls")
End If
Regards,
Tom Ogilvy
Your code works as advertized but let throw a wrench
into the works and say that there are multiple instances
of excel open on the same PC and that the file you are
checking for could be open on any of them?
... thoughts?
Thanks,
Cal