Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export from Access to Excel

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
I have a form which has a crosstab query result displayed. What I would like is to create a button which.....

Select everything from the datasheet displayed on the form and copy it.

Automatically start up Excel and open an *.xls file which is already created (this has a chart on it which will use the data from Access)

Automatically start the Excel macro (which I have set up in Excel to enter and format the data correctly in the worksheet).

.....Is it possible to do all of this in Access/Excel etc?

Any ideas/code examples/suggestions?

Thanks in advance,

Marcus

 
The easiest way is to use the clipboard. I'm not sure what object your data is coming from but you need to select the data then use copy. in excel i used:

Set MySelection = Selection
Selection.Copy

But you will need to find what the command it is to copy your data.

Then use this command

Interaction.Shell "Excel.exe c:\book2.xls", vbNormalFocus

This will load excel and open book2.xls.

In book2.xls you can then have a macro that Pastes the data into the correct place. Using command like

Selection.Paste
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top