![]() |
Import Access data to text file rather than Excel
I have the below code (copied from this forum) to extract data from Access
and copy it to the active Excel worksheet. What I want is for that last line to copy the data to a txt file, and save that file with name "myText.txt" to L:\Storage\ Thanks in advance! Daniel Bonallack _____________________ ' Open the connection Set Connection = New ADODB.Connection Cnct = "Provider=Microsoft.Jet.OLEDB.4.0; " Cnct = Cnct & "Data Source=" & DBFullName & ";" Connection.Open ConnectionString:=Cnct ' Create RecordSet Set Recordset = New ADODB.Recordset Recordset.Open Source:=SQLString, ActiveConnection:=Connection Range("A1").CopyFromRecordset Recordset |
Import Access data to text file rather than Excel
Please refer this link
http://www.freevbcode.com/ShowCode.asp?ID=548 If this post helps click Yes --------------- Jacob Skaria "Daniel Bonallack" wrote: I have the below code (copied from this forum) to extract data from Access and copy it to the active Excel worksheet. What I want is for that last line to copy the data to a txt file, and save that file with name "myText.txt" to L:\Storage\ Thanks in advance! Daniel Bonallack _____________________ ' Open the connection Set Connection = New ADODB.Connection Cnct = "Provider=Microsoft.Jet.OLEDB.4.0; " Cnct = Cnct & "Data Source=" & DBFullName & ";" Connection.Open ConnectionString:=Cnct ' Create RecordSet Set Recordset = New ADODB.Recordset Recordset.Open Source:=SQLString, ActiveConnection:=Connection Range("A1").CopyFromRecordset Recordset |
Import Access data to text file rather than Excel
It may just be too complex for me to work through, but I'll give it a go -
thanks. I thought there would be a simpler solution, given that my import to Excel is simple. "Jacob Skaria" wrote: Please refer this link http://www.freevbcode.com/ShowCode.asp?ID=548 If this post helps click Yes --------------- Jacob Skaria "Daniel Bonallack" wrote: I have the below code (copied from this forum) to extract data from Access and copy it to the active Excel worksheet. What I want is for that last line to copy the data to a txt file, and save that file with name "myText.txt" to L:\Storage\ Thanks in advance! Daniel Bonallack _____________________ ' Open the connection Set Connection = New ADODB.Connection Cnct = "Provider=Microsoft.Jet.OLEDB.4.0; " Cnct = Cnct & "Data Source=" & DBFullName & ";" Connection.Open ConnectionString:=Cnct ' Create RecordSet Set Recordset = New ADODB.Recordset Recordset.Open Source:=SQLString, ActiveConnection:=Connection Range("A1").CopyFromRecordset Recordset |
Import Access data to text file rather than Excel
Check this out:
http://www.accessmvp.com/KDSnell/EXCEL_ImpExp.htm HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Daniel Bonallack" wrote: It may just be too complex for me to work through, but I'll give it a go - thanks. I thought there would be a simpler solution, given that my import to Excel is simple. "Jacob Skaria" wrote: Please refer this link http://www.freevbcode.com/ShowCode.asp?ID=548 If this post helps click Yes --------------- Jacob Skaria "Daniel Bonallack" wrote: I have the below code (copied from this forum) to extract data from Access and copy it to the active Excel worksheet. What I want is for that last line to copy the data to a txt file, and save that file with name "myText.txt" to L:\Storage\ Thanks in advance! Daniel Bonallack _____________________ ' Open the connection Set Connection = New ADODB.Connection Cnct = "Provider=Microsoft.Jet.OLEDB.4.0; " Cnct = Cnct & "Data Source=" & DBFullName & ";" Connection.Open ConnectionString:=Cnct ' Create RecordSet Set Recordset = New ADODB.Recordset Recordset.Open Source:=SQLString, ActiveConnection:=Connection Range("A1").CopyFromRecordset Recordset |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com