You can use ADO. Here is a simple example
Public Sub QueryWorksheet()
Dim oRS As Object 'ADODB.Recordset
Dim sConnParams As String
Dim sSQL As String
sConnParams = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\myTest\volker1.xls;" & _
"Extended Properties=Excel 8.0;"
sSQL = "SELECT * FROM [Sheet1$];"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnParams, 0, 1, 1
'adOpenForwardOnly, adLockReadOnly , adCmdText
If Not oRS.EOF Then
Worksheets("Sheet1").Range("A1").CopyFromRecordset oRS
Else
MsgBox "No records found.", vbCritical
End If
oRS.Close
Set oRS = Nothing
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)