Getting data from a closed wbook
I appreciate you are trying to help. But again please read my question - it
is very specific.
I am already using ADO but I need the last used row before I begin to
extract data.
Using SQL to get a count with SELECT COUNT(*) does not work if a wbook has
been saved with an out of line UsedRange. One of the wbooks I have come
across had a UsedRange last cell of AF50918 whereas the real last cell was
S98.
When I did a record count on that wbook it returned 50917 instead of 97.
Using 2 associated recordsets and looping through all the fields provided
the correct last row / record count but it was painfully slow because it had
to work its way through 50,918 rows on X number of fields.
I had already been through the usual alternative methods until I came across
the method detailed in my post. I thought this might be worth a shot.
It works if the first field is numeric and doesn't throw its toys out of the
cot if it encounters a text field subsequently it just returns N/A. But if
seems if the first field of a wbook is text then it goes into an infinite
loop.
If I can get it right I can install formulae on the hidden wsheet in my
Add-in and pull in the last used row number and then simply calculate the
number of original records before I extract data from the closed wbook.
Hope that clarifies.
Geoff
"Jeff" wrote:
Try an ADO solution...
'Requires reference to microsoft Active X Data Objects Lib 2.7
|