Fordraiders
asked on
To Specifically export a sql query to a Excel workbook
Access 2010
Excel 2010
vba routine to export chnage to specific columns on a excel workbook template.
I have a query setup to export.
Set NewQuery = CurrentDb.CreateQueryDef(" Export_Tem p_Subform_ Query", sql)
strUserName = Environ("username")
strPath = "C:\Users\" & strUserName & "\desktop\Export_Temp_Subf orm_Query. xls"
DoCmd.OutputTo acOutputQuery, "Export_Temp_Subform_Query ", acFormatXLS, strPath, True
What I need:
To Specifically export to a Excel workbook.. called "Export_InPut_Data.xlslx"
I need Field(0) in the recordset to go to ColumnA in the workbook.
I need Field(1) in the recordset to go to ColumnB etc....
The cells on this workbook are FORMATTED exactly as i need them.
I'm hoping when the export is completed the formatting stays in place in the EXCEL workbook ?
Thanks
Fordraiders
Excel 2010
vba routine to export chnage to specific columns on a excel workbook template.
I have a query setup to export.
Set NewQuery = CurrentDb.CreateQueryDef("
strUserName = Environ("username")
strPath = "C:\Users\" & strUserName & "\desktop\Export_Temp_Subf
DoCmd.OutputTo acOutputQuery, "Export_Temp_Subform_Query
What I need:
To Specifically export to a Excel workbook.. called "Export_InPut_Data.xlslx"
I need Field(0) in the recordset to go to ColumnA in the workbook.
I need Field(1) in the recordset to go to ColumnB etc....
The cells on this workbook are FORMATTED exactly as i need them.
I'm hoping when the export is completed the formatting stays in place in the EXCEL workbook ?
Thanks
Fordraiders
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
On my way out of the office for a meeting, but do a search on "CopyFromRecordset" here in EE and you should find some code for that.
Dale