Advertisement

05.29.2008 at 10:51PM PDT, ID: 23443749
[x]
Attachment Details

Help exporting a table from access to excel using VBA.

Asked by rgn2121 in Access Coding/Macros, Microsoft Access Database

Tags: VBA, Access 2003

I am looking to be able to export from Access to and Excel template using VBA.  I have read where you can't format an Excel file on export from access, but I thought maybe if I designed a template then I could open it, dump the table data and then save as an excel workbook.

Currently I use the TransferSpreadsheet as listed below...

Is this possible to do?

I thought about something like this:

dim InputRow as integer
InputRow=3

Active_Worksheet.Cells(InputRow, 1) = InputRS.Fields("Field1")
Active_Worksheet.Cells(InputRow, 2) = InputRS.Fields("Field2")
Active_Worksheet.Cells(InputRow, 3) = InputRS.Fields("Field3")
Active_Worksheet.Cells(InputRow, 4) = InputRS.Fields("Field4")
Active_Worksheet.Cells(InputRow, 5) = InputRS.Fields("Field5")
Start Free Trial
1:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, tbl, strXLSName, True
[+][-]05.29.2008 at 10:56PM PDT, ID: 21675516

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 11:01PM PDT, ID: 21675536

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 11:31PM PDT, ID: 21675649

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Access Database
Tags: VBA, Access 2003
Sign Up Now!
Solution Provided By: kelvinsparks
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.29.2008 at 11:38PM PDT, ID: 21675679

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 11:49PM PDT, ID: 21675710

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628