Hi
Yes you can connect to Excel with ADO, this code seems to work
Code:
Sub TestExcel()
Dim strCon As String
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
strCon = "Provider=MSDASQL.1;" & _
"Data Source=TestExcelConnection;Extended" & _
"DBQ=H:\DBForum\TestDB.xls;" & _
"DefaultDir=H:\DBForum"
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open strCon
rs.Open "SELECT * FROM [Sheet1$]", cn
Do Until rs.EOF
MsgBox rs(2)
rs.MoveNext
Loop
End Sub
You can also specify a range name as the "Table" (including field names in the top row)
ie if the data you want is in the range named 'TableRange' then use this
rs.Open "SELECT * FROM TableRange", cn
You could also open the required workbook and copy anything you like into the 'current' workbook and close it afterwords.
If you turn ScreenUpdating off before and on again afterwards, you would be non the wiser.
If you do this, set a reference (object variable) to the 'current' workbook before opening the second book as this becomed the 'current' book when opened.
This is my normal way with spreadsheet, mainly because they usually (always!) have different name or are in different places or both.
HTH
MTB