LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default How to read Rows within a Column through ADO ...

Hello -

I have been experimenting with ADO a little bit and would now like to
open a connection to an Excel file and read the text of rows within a
column. So far I was able to get the first rows of columns (headers)
but how can I get text from a specific cell or range?

Here is what I have so far ...

Dim szFullName As String

Dim objConnection As ADODB.Connection
Dim objCatalog As ADOX.Catalog
Dim objTable As ADOX.Table
Dim lIndex As Long
Dim szConnect As String
Dim szSheetName As String

szFullName = CStr(Application.GetOpenFilename("Excel Files
(*.xls),*.xls", , "Select an Excel File"))

szConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
szFullName & ";Extended Properties=Excel 8.0;"

Set objConnection = New ADODB.Connection
objConnection.Open szConnect
Set objCatalog = New ADOX.Catalog
Set objCatalog.ActiveConnection = objConnection

Dim objColumn As ADOX.Column

For Each objTable In objCatalog.Tables
If InStr(objTable.Name, "A") 0 Then
For Each objColumn In objTable.Columns
MsgBox (objTable.Name & " " & objColumn & "<")
Next objColumn
End If
Next objTable

objConnection.Close
Set objCatalog = Nothing
Set objConnection = Nothing

Any suggestions are highly appreciated!

Thanks!
Joe

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read data from a Row to a Column Ken G. Excel Discussion (Misc queries) 5 September 11th 08 02:01 PM
How can I read over than 65,536 rows from excel spreed sheet Lillian Excel Discussion (Misc queries) 2 April 16th 06 01:47 AM
how can i change column to read a.b.c.etc and not 1.2.3. Column Chris Excel Discussion (Misc queries) 2 April 6th 06 10:35 AM
how does excel read only odd numbered rows of data froma column? Rose_mina Excel Worksheet Functions 3 May 15th 05 05:22 PM
Read only lock on rows eyecalibrate[_4_] Excel Programming 0 March 5th 04 09:32 PM


All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"