Using OutputTo Excel - Can I get it to make multiple worksheets

S

Stapes

Hi

I am using the following command to put the results of a query in to
an excel spreadsheet:

DoCmd.OutputTo acOutputQuery, "Emission Trading Log", _
acFormatXLS, "ETL.xls", True

I end up with a file called "ETL.xls" with a Worksheet called
"Emission Trading Log". Is there any way that I can create more than
one worksheet with this command - each with a different name? I want
one sheet for each trader.

Stapes
 
G

Guest

The following code can be used multiple times for the same work book (in the
on click event of a button). I have included a Dim statement to include the
date and time the file was created (FYI)

Dim sToday As String

sToday = Format(Now, "yyyy.mm.dd hh.mm")

DoCmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, "QUERY NAME", _
"C:\FILE LOCATION AND NAME - " & sToday & ".xls", True, "SHEET NAME"
 
S

Stapes

The following code can be used multiple times for the same work book (in the
on click event of a button). I have included a Dim statement to include the
date and time the file was created (FYI)

Dim sToday As String

sToday = Format(Now, "yyyy.mm.dd hh.mm")

DoCmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, "QUERY NAME", _
"C:\FILE LOCATION AND NAME - " & sToday & ".xls", True, "SHEET NAME"

--

http://www.ready4mainstream.ny911truth.org/index.html









- Show quoted text -

Brilliant - I like your Conspiracy links too!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top