> Well, linking the spreadsheet isn't really an option for me, because I
> have to extract the data at a given point - programmatically.
Well, if the spreadsheet is linked, it's like a table. But I'm missing
the point from what you say.
> The TransferSpreadsheet method only works if I use automation to open
> the spreadsheet first. I cannot do this, because there is a chance
[quoted text clipped - 3 lines]
> data from the spreadsheet while it's opened exclusively by a different
> user. Thanks for the reply, salad!
How about this. Do a FileCopy of the spreadsheet. Now I'm not sure if
"new" data will be captured during a filecopy. I doubt it...you'd
probably get the data from the last time the sheet was saved/closed.
Anyway, if you can live with that, filecopying it to another file and
then processing the new one should work. How's that? It's a kludge,
it's a possibility...
See
Dir
Kill
FileCopy
in help for using this concept.
Syvman - 03 Feb 2006 22:38 GMT
I think you're on to something here - looks like I need to find out now
if I can copy the file while it's already open. If that's possible,
then I'll do a file copy to a temp directory so the user can import
that data.
What I meant by not being able to link to the spreadsheet is that I am
only needing portions of the spreadsheet (namely only one column -
starting at row 4). By linking the spreadsheet as a table, I could get
the data, but I am not sure how to make sure that I ignore the top 3
rows in the spreadsheet (they just become records in the linked table).
That's why I don't think I can use a linked table. However, I am
going to play with this over the weekend also.
Thanks for your help, salad - and if you think of any other possible
solutions, please don't hesitate to let me know - I really appreciate
the help! Thanks again, and have a great weekend!
Syvman - 03 Feb 2006 22:43 GMT
Oh, also - another reason linking wouldn't work for me is because there
are about 12 "worksheets" within the spreadsheet file, and this would
require 12 linked tables. No big deal, but another worksheet can be
added anytime, and I need to be able to determine how many worksheets
are within the spreadsheet at run-time and ensure that I import the
data from all of them. That's why I thought ADO would be the best
approach, because you can use the OpenSchema property to get the list
of worksheets out of an excel sheet. BUT - the first approach you
suggested (copying the file so the user can have the same file open
simultaneously) would probably work with automation - as long as I can
copy the file while it's already open. I'm going to go test that now.
Thanks again!
salad - 04 Feb 2006 15:58 GMT
> Oh, also - another reason linking wouldn't work for me is because there
> are about 12 "worksheets" within the spreadsheet file, and this would
[quoted text clipped - 8 lines]
> copy the file while it's already open. I'm going to go test that now.
> Thanks again!
OK. I guess I'm getting hung up on the word ADO. What about VBA? If
you can use automation then perhaps you can work it out. Go to
http://groups.google.com/advanced_search?hl=en
and enter phrases like
Excel object
and in the groups enter
*access*
There's another reference site you might want to visit.
http://www.mvps.org
On the right hand side there's a frame. Scroll down and see Excel links.
Of course, if you can't use VBA then above is useless.