Excel's Marco Convert data to Access

P

Paul

Thank you for reading my post.

I want to write a marco which can auto convert the excel
sheet data into a existing access table.

This program is design for new user to excel and access.
Just click the marco will auto do all steps.

Thank you.
 
D

Dick Kusleika

Paul

You don't give a lot of details, so I can't give you a lot of details.
Here's an example that appends the data in a range called MyTable on the
ActiveSheet to a table in the database c:\Dick\db1.mdb called Table 1. You
need to set a reference in the VBE (Tools - References) to the Microsoft
Access x.x Object Library. This is using XL2000, Acc97 and Win98.

Sub AppendAccessTable()

Dim acapp As Access.Application

Set acapp = New Access.Application

ThisWorkbook.Save

acapp.OpenCurrentDatabase "C:\Dick\db1.mdb"

acapp.DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel97, _
"Table 1", _
ThisWorkbook.FullName, _
True, _
"MyTable"

acapp.Quit

Set acapp = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top