ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ADO help (https://www.excelbanter.com/excel-programming/432687-ado-help.html)

Kash

ADO help
 
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?

jamescox[_109_]

ADO help
 

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



All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com