| Marcel Vreuls
vrm at tim-cms.com
Tue Aug 2 08:58:49 CDT 2005
Lonnie, I use the following function for all export to XL. The sql string you can replace with query, SP or sql string with header information. The objProgress is a progressbar you can replace with your own one. Public Function fncExportNaarExcel(strSQL As String) On Error Resume Next 'ivm het eventueel niet aanwezig zijn van de exporteren query If strSQL = "" Or IsNull(strSQL) Then MsgBox "Er kunnen geen gegevens gevonden worden", vbInformation, OopMsgboxHeader Exit Function Else Dim objProgress As New clsProgress Dim daodatabase As DAO.database Set daodatabase = CurrentDb() objProgress.ShowProgress objProgress.TextMsg = "Collect data..." daodatabase.QueryDefs.Delete ("Exporteren") objProgress.TextMsg = "Exporteren data..." daodatabase.CreateQueryDef "Exporteren", strSQL objProgress.TextMsg = "Start Microsoft Excel..." DoCmd.OutputTo acOutputQuery, "Exporteren", acFormatXLS, "c:\export.xls", True objProgress.HideProgress Set objProgress = Nothing End If Exit Function End function -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Lonnie Johnson Sent: dinsdag 2 augustus 2005 14:35 To: AccessD solving' Subject: [AccessD] Writing to an excel file I have a recordset that I would like to write as rows in an excel spreadsheet. I want to start on a certain line. The columns are already predefined and match my recordset. This will run each month so it will need to overwrite the prior month's data. What is the best way to go about this? May God bless you beyond your imagination! Lonnie Johnson ProDev, Professional Development of MS Access Databases Visit me at ==> http://www.prodev.us --------------------------------- Start your day with Yahoo! - make it your home page -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com