ADO help

K

Kash

Hi, I'm using ADO to get data frm closed excel sheet. But when the file from
which I'm trying to get data is opened in some other system, then excel will
try opening that file.. is there a way to avoid this?
 
J

jamescox

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
 
Top