Importing rather than opening XLS
Importing rather than opening XLS
Author
Discussion

ProPlus

Original Poster:

3,810 posts

270 months

Tuesday 12th September 2006
quotequote all
Is there a quick method to import an XLS doc into Excel without opening the actual file?

I want to be able to use my existing xls doc and import another xls into it, but not use:

Workbooks.Open FName

Do I have to go in and import it row by row just to get past this or is there another way round it??

In the same query if I needed to import sheet2 of a workbook into my xls file, how would I do that progamatically.....

5 days and I don't need to touch this system ever again!!!

Cheers for any help.

Plotloss

67,280 posts

300 months

Tuesday 12th September 2006
quotequote all
Presumably you could use the spreadsheet to be imported as an ODBC source?

ProPlus

Original Poster:

3,810 posts

270 months

Tuesday 12th September 2006
quotequote all
Plotloss said:
Presumably you could use the spreadsheet to be imported as an ODBC source?


How would you do that??

FunkyGibbon

3,863 posts

294 months

Tuesday 12th September 2006
quotequote all
ProPlus said:
Plotloss said:
Presumably you could use the spreadsheet to be imported as an ODBC source?


How would you do that??


On the menu bar:

Data -> Import External Data -> Import Data... -> select file type as excel spreadsheet (*.xls)

should do the trick

atomicrex

862 posts

257 months

Tuesday 12th September 2006
quotequote all
If you are able to write VBA code then you always create an ADO connection.

Its a good way to read the data, however dont ever try and use an ado recordset to query a range within an open book. It is impossible to close the damn thing!!!

Need any help just ask ive loads of examples

ProPlus

Original Poster:

3,810 posts

270 months

Tuesday 12th September 2006
quotequote all
atomicrex said:
If you are able to write VBA code then you always create an ADO connection.

Its a good way to read the data, however dont ever try and use an ado recordset to query a range within an open book. It is impossible to close the damn thing!!!

Need any help just ask ive loads of examples


if you have some examples I would be most grateful..

Cheers

ATG

23,828 posts

302 months

Tuesday 12th September 2006
quotequote all
XLS documents are a structured, uhm, mess. There's no easy way of just reading the data for a range without opening the whole damn file first. It would be possible to write something to do this, but it would be reinventing the wheel, as that is what Excel itself does. I'd be a little surprised if opening the workbook and copying data from it was any less efficient than treating it as a data source and using ADO, as I suspect the ADO route is itself just a thin wrapper sitting on top of the same Excel code. I could well be wrong, but I'd definintely look at memory consumption and performance for both metgods before plumping for ADO.

atomicrex

862 posts

257 months

Tuesday 12th September 2006
quotequote all
ProPlus said:
atomicrex said:
If you are able to write VBA code then you always create an ADO connection.

Its a good way to read the data, however dont ever try and use an ado recordset to query a range within an open book. It is impossible to close the damn thing!!!

Need any help just ask ive loads of examples


if you have some examples I would be most grateful..

Cheers


PM me and I will send you some examples

ProPlus

Original Poster:

3,810 posts

270 months

Tuesday 12th September 2006
quotequote all
atomicrex said:
ProPlus said:
atomicrex said:
If you are able to write VBA code then you always create an ADO connection.

Its a good way to read the data, however dont ever try and use an ado recordset to query a range within an open book. It is impossible to close the damn thing!!!

Need any help just ask ive loads of examples


if you have some examples I would be most grateful..

Cheers


PM me and I will send you some examples


YHM