Results 1 to 4 of 4
  1. #1
    rparmar is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    3

    Creating excel file from access vba

    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.

  2. #2
    c_smithwick is offline Underpaid Programmer
    Windows 7 Access 2003
    Join Date
    Jan 2010
    Location
    Lakeside, CA
    Posts
    49
    look up "transferSpreadsheet" in the VBE help menu

  3. #3
    rparmar is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    3

    Error on creating excel file from access vba

    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

  4. #4
    rparmar is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    3
    It is resolved now, what just a typo error

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Splitting an Excel File into Multiple Access Tables on Import
    By TheWolfster in forum Import/Export Data
    Replies: 4
    Last Post: 04-29-2010, 04:52 AM
  2. #Num, Linked Excel File
    By Rick West in forum Import/Export Data
    Replies: 5
    Last Post: 02-04-2010, 10:50 AM
  3. Access 2007 file size vs Excel
    By andrewalms in forum Access
    Replies: 4
    Last Post: 02-02-2010, 02:32 PM
  4. Creating report from Word file
    By jonny in forum Reports
    Replies: 0
    Last Post: 10-15-2009, 03:10 PM
  5. Replies: 0
    Last Post: 04-29-2009, 04:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums