View Full Version : Exporting data to excel from access


nh1234
03-27-2006, 01:01 PM
hi,

I am trying to export specific information from access to excel, but to a specific file, sheet and cell?

Is there a way to do this and if so how?

JimmyK
04-16-2006, 06:10 PM
hi,

I am trying to export specific information from access to excel, but to a specific file, sheet and cell?

Is there a way to do this and if so how?

Hi,

I have included a very short example of a database that allows you to do what you want. What it does is:


allows you to set the directory & filename you want to use
export data to specific cells
save & close the spreadsheet


What I have it do is run excel invisibly whilst it is entering the data as from my experience people like to click on things when it's running and it always stuffed things up! Therefore I made it run invisibly so they couldn't do anything until after it had been generated. So you will see I have two functions, openexcel & openexcel_visible. The first one is what I use to open and not show Excel. The second I use at the end of the procedure to open the completed file and show Excel. It's saved me a lot of hassle.

Here are some pointers from the MS MSDN website:

How to Reference Cells and Ranges [Excel 2003 VBA Language Reference] (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlhowSelectingandactivatingcells1_HV05204866.asp)
Selecting and Activating Cells [Excel 2003 VBA Language Reference (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlhowSelectingandactivatingcells1_HV05204866.asp)
Cells Property [Excel 2003 VBA Language Reference] (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlproCells1_HV03076630.asp)

Here is a handy link to a post on this forum on this subject:
Exporting to a specific excel spreadsheet, and a specific worksheet/cells (http://www.access-programmers.co.uk/forums/showthread.php?t=95063&highlight=openexcel)

Hope this helps.