Not sure if this would work, but it might be worth a quick test.
You could copy the Excel file, save it with a new name and then use ADO
to read from it, then kill the copied file.
Excel lets you copy a workbook that is open and save it, so this would
make sure that the workbook you are trying to open is closed.
That's a lot of overhead to do every time you want to read from a
workbook, when most often the workbook will be closed. A search with
terms
gave a bunch of hits, with the following one looking interesting:
'Visual Basic sample code - Determine if a File is open - Source code
examples' (
http://tinyurl.com/ljzbom)
although in the comments it says it will return a "not open" status if
the file has not been opened exclusively - which sounds like the way
Excel works. But, it might tell you - you'd just have to check it. And
of course, there may be other code samples on the web that can detect
files open non-exclusively; you would need to do more research...
Hope this helps - please post back on what you learn! :Bgr
--
jamescox
------------------------------------------------------------------------
jamescox's Profile:
http://www.thecodecage.com/forumz/member.php?userid=449
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=127311