Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Access Newsgroups
Access Forms Coding
Exporting To Excel
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="B F Cole, post: 1808762"] I have several tables that I want to export to Excel and have them exist on separate worksheets within the same workbook. I'm using this code which creates the Excel workbook. How do I cause the second output query to create the second sheet in the same Workbook. instead of overwriting theWorkbook and having only the last output as a worksheet? sExcelFile = "DataTables.xls" stDocName = "qryTable1" ' First Table to output On Error Resume Next DoCmd.OutputTo acOutPutQuery, stDocName, acFormatXLS, sExcelFile, 0 If Err Then iAnswer = MsgBox("Error detected on Output 1",vbCritical) End If ' Second Table to output stDocName = "qryTable2" On Error Resume Next DoCmd.OutputTo acOutPutQuery, stDocName, acFormatXLS, sExcelFile, 0 If Err Then iAnswer = MsgBox("Error detected on Output 2",vbCritical) End If etc, for more tables Thanks for your suggestions. They have always solved a problem quickly. Bill [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Access Newsgroups
Access Forms Coding
Exporting To Excel
Top