Solved

Create Spreadsheet

Posted on 2001-06-19
4
262 Views
Last Modified: 2010-05-02
How can I create an Excel spreadsheet from an Access table?
0
Comment
Question by:northeyk
  • 3
4 Comments
 
LVL 5

Expert Comment

by:AndrewDev
ID: 6205964
Try this, I think it is what you want

http://www.freevbcode.com/ShowCode.Asp?ID=2182

Regards
Andrew
0
 
LVL 5

Expert Comment

by:AndrewDev
ID: 6205975
or even better this one

Export an Access Table to an Excel Spreadsheet
http://www.freevbcode.com/ShowCode.Asp?ID=2794
0
 
LVL 5

Accepted Solution

by:
AndrewDev earned 50 total points
ID: 6205978
This is the code from the above link

Private Sub ExportOneTable()

'EXPORTS TABLE IN ACCESS DATABASE TO EXCEL
'REFERENCE TO DAO IS REQUIRED

Dim strExcelFile As String
Dim strWorksheet As String
Dim strDB As String
Dim strTable As String
Dim objDB As Database

'Change Based on your needs, or use
'as parameters to the sub
strExcelFile = "C:\My Documents\MySpreadSheet.xls"
strWorksheet = "WorkSheet1"
strDB = "C:\My Documents\MyDatabase.mdb"
strTable = "MyTable"

Set objDB = OpenDatabase(strDB)

 'If excel file already exists, you can delete it here
 If Dir(strExcelFile) <> "" Then Kill strExcelFile

objDB.Execute _
  "SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _
   "].[" & strWorksheet & "] FROM " & "[" & strTable & "]"
objDB.Close
Set objDB = Nothing

End Sub

0
 

Expert Comment

by:romilson
ID: 6205988
Hello ,
If you won't to use progremming ,,
use can enter in Excel and make the steps:

- Click in "Data" menu
- Click in Obtain External Data
- Create new Query
- select access data base
- select the access data base file (.mdb)
- select the table
and click and next till finish

:-)

Romilson
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

860 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