ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there a better option than Getobject to access a .xls? (https://www.excelbanter.com/excel-programming/280682-there-better-option-than-getobject-access-xls.html)

Dave F[_4_]

Is there a better option than Getobject to access a .xls?
 
Hi

Excel '98 & 2002. AutoCAD 2002

I'm running a vba routine within AutoCAD to access the info within a .xls
file.
I'm using Getobject, but have just been told that even though it doesn't
display the spreadsheet, it still loads it into an instance of Excel.

Is this correct?

In AutoCAD VBA there's a command (ObjectDBX) to access other AutoCAD files
databases without loading in an instance.

Is there an equivalent in Excel?

Thanks in advance

Dave F.




Jon Peltier[_4_]

Is there a better option than Getobject to access a .xls?
 
Dave -

In Excel, you could use Application.Workbooks("Name.xls").Open, but from
AutoCAD you'd have to use GetObject anyway to open a new instance or
access a running instance of Excel.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Dave F wrote:

Hi

Excel '98 & 2002. AutoCAD 2002

I'm running a vba routine within AutoCAD to access the info within a .xls
file.
I'm using Getobject, but have just been told that even though it doesn't
display the spreadsheet, it still loads it into an instance of Excel.

Is this correct?

In AutoCAD VBA there's a command (ObjectDBX) to access other AutoCAD files
databases without loading in an instance.

Is there an equivalent in Excel?

Thanks in advance

Dave F.





Tom Ogilvy

Is there a better option than Getobject to access a .xls?
 
If you want to work with the file, unless you write your own file
interpreter, then you need to open excel. If your file is set up like a
database and you just want to retrieve the data, you can treat an excel file
as a database file and use ADO or DAO.

--
Regards,
Tom Ogilvy

"Dave F" wrote in message
...
Hi

Excel '98 & 2002. AutoCAD 2002

I'm running a vba routine within AutoCAD to access the info within a .xls
file.
I'm using Getobject, but have just been told that even though it doesn't
display the spreadsheet, it still loads it into an instance of Excel.

Is this correct?

In AutoCAD VBA there's a command (ObjectDBX) to access other AutoCAD files
databases without loading in an instance.

Is there an equivalent in Excel?

Thanks in advance

Dave F.







Dave F[_4_]

Is there a better option than Getobject to access a .xls?
 
Tell me more...

If your file is set up like a database


Do I have to do anything special to do this?
My workbook has a few worksheets with standard columns of numeric numbers.

and you just want to retrieve the data, you can treat an excel file
as a database file and use ADO or DAO.


I have vague memories that ADO is newer than DAO. Correct?
Which is better/faster of the two?

Are they faster than using GetObject, which definately slows my routine
down?

Thanks in advance

Dave F.



Tom Ogilvy

Is there a better option than Getobject to access a .xls?
 
You can check out sample code at Mr. Erlandsen's site:

http://www.erlandsendata.no/english/vba/adodao/

Also:


http://support.microsoft.com/?kbid=257819
HOWTO: Use ADO with Excel Data from Visual Basic or VBA


http://support.microsoft.com/?kbid=278973
SAMPLE: ExcelADO Demonstrates How to Use ADO to Read and Write Data in Excel
Workbooks

I would expect ADO to be faster, but haven't really tested it, so can't say.

--
Regards,
Tom Ogilvy


"Dave F" wrote in message
...
Tell me more...

If your file is set up like a database


Do I have to do anything special to do this?
My workbook has a few worksheets with standard columns of numeric

numbers.

and you just want to retrieve the data, you can treat an excel file
as a database file and use ADO or DAO.


I have vague memories that ADO is newer than DAO. Correct?
Which is better/faster of the two?

Are they faster than using GetObject, which definately slows my routine
down?

Thanks in advance

Dave F.






All times are GMT +1. The time now is 04:03 PM.

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