Solved

MS Access export to Excel template

Posted on 2013-05-31
6
607 Views
Last Modified: 2013-05-31
Hi,

I would be very grateful if someone could help me with the following.

I have an Excel workbook with several worksheets and VBA.  I would like to export data from various tables in an Access database to the Excel workbook.  

Is there an equivalent of the Workbook.SaveAs method in Excel that I can use in Access?  Effectively, I would like to open the Excel workbook as a template and save the updated version with a different filename?

Many thanks in advance
Alison
0
Comment
Question by:alisonthom
  • 3
  • 2
6 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 39211631
In Access, the item you should look at to start is the transfer spreadsheet method.  This will allow you to export a table or query to a workbook.

You would start out by copying your template file  and saving it with a new name.  Then use transfer spreadsheet to export your data to the new workbook.  I'm working from my iPad or I would provide a code example.

You can also search EE on "transferdatasheet" to get some examples.
0
 
LVL 16

Expert Comment

by:Calvin Brine
ID: 39211646
Are you executing the VBA from your Excel workbook?  So, you want to import data from the your access database to your excel worksheet?  I would suggest you setup an ADO connection to your database, and use SQL to extract your data to excel.  Once you have an ADO recordset in your excel code, you can place the results of your SQL query where ever you want in excel.  Without have details of your access table names, database location, which sheet and cell you want to place the access data in etc... , it would be difficult to give you code.

HTH
Cal
0
 

Author Comment

by:alisonthom
ID: 39211679
With respect to the response from Chrine, the VBA code to export data from Access to Excel is within Access.  Can I achieve my objective using VBA in Access?

Thanks
Alison
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39211695
Alison, yes, you can, see my comment and Search the Access zone for the TransferSpreadsheet method.
0
 

Author Closing Comment

by:alisonthom
ID: 39211993
It is now working as I hoped.
fyed - Thanks so much for your help
Alison
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39212002
Glad I could help.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question