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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Excel from Access

Status
Not open for further replies.

trium123

IS-IT--Management
Apr 8, 2005
15
GB
Hi All.
I'm trying to open excel by using a command button in access. Then, using code, i would like to open a new worksheet and copy the contents of a query into the worksheet.
So far i can open Excel, but that's it.
I have also added the excel references in Access.
I understand a little about "with" statements and using the "sheets.add" commands e.t.c. but it's the initial declarations i'm stuck with.
If anyone can spare a bit of their time to help me then i'd be very grateful.
Thanks all.
 
Rather than instantiating a version of excel, have a look at the docmd.transferspreadsheet method in access - might find it a lot easier
 
Thanks for your suggestion, but the reason i wanted to know about adding worksheets was because eventually i will have to copy 4 seperate queries into 4 seperate worksheets in the same workbook. Yes i think the docmd.transferspreadsheet method would work fine, but i would need to get the correct worksheet in focus first.
Any ideas again, gratefully received..
Thanks All.
 
That's not a problem. A new sheet will be added to the excel workbook with the name of the table/query that you are exporting.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
if you are dead set on opening excel etc, have a look at TopJacks post in this thread:
thread707-925996

but I would seriously suggest using the transferspreadsheet method if you are relatively new to VBA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top