Export data from Access to Excel

drpkrupa

Registered User.
Local time
Today, 16:16
Joined
Jun 1, 2009
Messages
13
I want a write small program which does follwoing three tasks.
1) Open master excel file from C:\Test.xls.
2) Save As the master drawing with c:\Test_Now().xls
3) Open new save as file and select tab "Data" and bind B6, B9 and C10 feilds from database.

I know how to pull data from database but don't know how to open and save the excel file and then select cell and copy database value to the cell.

Any Example or sample code.
 
I want a write small program which does follwoing three tasks.
1) Open master excel file from C:\Test.xls.
2) Save As the master drawing with c:\Test_Now().xls
3) Open new save as file and select tab "Data" and bind B6, B9 and C10 feilds from database.

I know how to pull data from database but don't know how to open and save the excel file and then select cell and copy database value to the cell.

Any Example or sample code.

I believe you can add excel library in access and then use that to work with excel, that way will give more functionality but requires more knowledge about codes, but here's a simple way:

shell("C:\Test.xls") 'will open the excel file

If you want to create a new copy of Test.xls before you make changes to it, do this:

dim sourceFile, destFile as string

sourceFile = "C:\Test.xls"
destFile = "C:\Test_" & Format (Now(),"dd/mm/yyyy hh:mm:ss") & ".xls"
FileCopy sourceFile, destFile
Shell destFile

' I haven't tried this, so I don't know if the "now()" will work, I know "Date" does work.


Access help should be a good place to look for how to select cells and save the excel file from Access, I know I came across those before.
 

Users who are viewing this thread

Back
Top Bottom