I am new to access vba and need to create excel file with values populated from a local table in access.
I am using DAO and need the definitions of excel objects.
Thanks.
I am new to access vba and need to create excel file with values populated from a local table in access.
I am using DAO and need the definitions of excel objects.
Thanks.
look up "transferSpreadsheet" in the VBE help menu
Below is what I am trying to run. It gives error on red highlighted line.
- Run time error '429': ActiveX object can't create component.
Public Function runCode()
Dim rs As dao.recordset
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set rs = CurrentDb.OpenRecordset("alpha")
Set oExcel = CreateObject("Excel.Appication")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
Debug.Print rs
'transfer the data to excel
oSheet.Range("B1").CopyFromRecordset rs
'save the workbook and quit excel
oBook.SaveAs "D:\DATABASES\REPORTDB\NEVADAREPORTSDB\AdHoc_Repor ts\transfer.xls"
oExcel.Quit
rs.Close
Set rs = Nothing
End Function
It is resolved now, what just a typo error