Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4344732
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:56:19+00:00 2026-05-21T11:56:19+00:00

I have a table in MS Access, which has the following data to be

  • 0

I have a table in MS Access, which has the following data to be exported to excel

  1. Release numbers
  2. Test cases
  3. Results

After exporting to Excel I want to have distinct release numbers as rows starting from A2 and distinct test case name as columns starting from B1. There might be couple thousands records. Then each cell will be set to result tag. Additionally will need some fancy coloring/bordering stuff.

The question – is it possible to do this using VBA in Access and if yes what is the way to go? Any hint, sample, example, resource would be appreciated… I’ve googled but the most thing I came accross is DoCmd.TransferSpreadsheet or DoCmd.OutputTo which I believe will not do what I want. Saw some examples with CreateObject("Excel.Application") but not sure what are limitations and performance using this way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:56:19+00:00Added an answer on May 21, 2026 at 11:56 am

    Yes, there are many cases when the DoCmd.TransferSpreadsheet command is inadaquate.

    The easiest way is to reference the Excel xx.x Object model within Access (Early Binding). Create and test your vba export function that way. Then once you are satisfied with your output, remove the Excel object model reference, then change your objects to use use Late Binding using CreateObject. This allows you to easily have other machines that are using different versions of Excel/Access to use it just the same.

    Here is a quick example:

    Sub ExportRecordsetToExcel(outputPath As String, rs As ADODB.Recordset)
    'exports the past due report in correct formattig to the specified path
    
    On Error GoTo handler:
    
        Const xlUP              As Long = -4162 'excel constants if used need to be referenced manually!
        Dim oExcel              As Object
        Dim oBook               As Object
        Dim oSheet              As Object
        Dim row                 As Long
    
        If rs.BOF And rs.EOF Then
            Exit Sub 'no data to write
        Else
            rs.MoveFirst
        End If
    
        row = 1
    
        Set oExcel = CreateObject("Excel.Application")
        oExcel.Visible = False 'toggle for debugging
    
        Set oBook = oExcel.Workbooks.Add 'default workbook has 3 sheets
    
        'Add data to cells of the first worksheet in the new workbook.
        Set oSheet = oBook.worksheets(1)
    
        Do While rs.EOF = False
    
            oSheet.range("A" & row).value = rs.Fields("MyField").value
    
            'increase row
            row = row + 1
        Loop
    
        oBook.SaveAs (outputPath)
    
    'tidy up, dont leave open excel process
        Set oSheet = Nothing
        Set oBook = Nothing
        oExcel.Quit
        Set oExcel = Nothing
    Exit Sub
    handler:
    
        'clean up all objects to not leave hanging processes
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an Access DB which has a set of local tables and input
I have an Access database in which I drop the table and then create
I have an Access 2002 application which links an Oracle table via ODBC with
Have a linking (or ref) table which has a dual primary key. Need to
I have a data access layer which returns DataSets/DataTables by executing Stored Procedure. Everything
I have got a table in MS Access 2007 with 4 fields. Labour Cost
I have the table (Product_Id, category priority, atribute1, atribute2...) in MS Access, and I
I have a legacy MS Access 2007 table that contains 52 fields (1 field
I have a field on a table in MS Access, tblMyTable.SomeID, and I want
If I have a class representing access to one table in my database in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.