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

Need help having asp create Multiple Worksheets in Excel

Status
Not open for further replies.

bcapps

Technical User
Jul 11, 2001
23
US
I am ok with creating an Excel spreadsheet from asp.
What I need to know is how can I create multiple pages?

My current code is something like this, and works fine, but all is returned on one page, I am performing a loop to create like spreadsheets from various database tables and each time I start back at the top, I would rather create a new worksheet and name it instead of simply creating another header on the single worksheet:

<%
Response.ContentType = &quot;application/vnd.ms-excel&quot;
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Open &quot;ASPWorkBook&quot;
SQLString = &quot;SELECT * FROM tblTable&quot;
Set RecordSet = Conn.execute(SQLString)
%>
<TABLE BORDER=1>
<%
Do Until RecordSet.EOF
%>
<TR>
<TH><%=RecordSet(&quot;Name&quot;)%></TH>
</TR>
<%
Here is where the code for an embedded SQL String and loop for each worksheet in excel would reside.
%>
<%
RecordSet.MoveNext
Loop
%>
</TABLE>

I've made various attempts and all have failed. I am coding with vbscript. Any help would be greatly appreciated.

Thanks
bcapps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top