jz, would you mind helping me on some code for exporting a report to a excel template? You are the only person on here that I think is the best.. Here is the code that I have but its not working. Any help would be greatly appreciated Thank you
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("[rptcslw/selectionsbyworkitem]", dbOpenDynaset)
'Create a new workbook in Excel
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
'Transfer the data to Excel
oSheet.Range("A4").CopyFromRecordset rs
'Save the Workbook and Quit Excel
oBook.SaveAs "C:\users\lowana.hernandez\csl"
oExcel.Quit
'Close the connection
Set rs = Nothing
Set db = Nothing
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("[rptcslw/selectionsbyworkitem]", dbOpenDynaset)
'Create a new workbook in Excel
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
'Transfer the data to Excel
oSheet.Range("A4").CopyFromRecordset rs
'Save the Workbook and Quit Excel
oBook.SaveAs "C:\users\lowana.hernandez\csl"
oExcel.Quit
'Close the connection
Set rs = Nothing
Set db = Nothing