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

Access tables to one Excel workbook

Status
Not open for further replies.

KenG

Technical User
Mar 20, 2000
67
US
I'd like to export two tables in Access into one Excel workbook as two separate sheets.<br>Is it possible to do this? <br>I have VBA in Excel that is running VBA in Access, so I can either export or import on either end, which ever is easiest.
 
open the table you want to export click on file,export select to excel, match your version ,locate the workbook you want to export to, it will create a new sheet when you click OK That simple
 
I'm sorry that I wasn't more specific in my post, but I'd like to do this using VBA without user input, and create the new sheets in the currently open workbook.<br>I haven't been able to do this yet and I think it is because the Excel file is currently open so Access can't write to the file. <br>But I was hoping that there might be a way around this problem.<br>
 
To do it in VBA use<br>DoCmd.TransferSpreadsheet [transfertype][,spreadsheettype], tablename, filename[, hasfieldnames][, range]<br>something like this <br><br>DoCmd.TransferSpreadsheet acExport, , &quot;Your Table&quot;, &quot;c:\my documents\Yoursheet.xls&quot;<br><br>but this errors if sheet is open so probably not much help<br>You need someone smarter then me. Should be easy to find;)<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top