RB said:
Thanks, I thought it would be something like that, but the quoted thread
is
a bit sparse. How is the query actually executed?
Would you have any more complete code sample?
You don't need me to tell you how to create an ADO connection to a
non-existant Excel workbook and execute the SQL, do you <g>?
Sub JustFourLines()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
con.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Extended Properties=Excel 8.0;" & _
"Data Source=C:\doesnotexist.xls"
con.Execute _
"SELECT fname, minit, lname" & _
" INTO [Text;Database=C:\My Folder\;].MyFile#txt FROM
[ODBC;Driver={SQL" & _
" Server};SERVER=MYSERVER;DATABASE=pubs;UID=***;Pwd=***;].employee;
"
End Sub
Jamie.