using asp to generate excel = bad stuff

J

Jeremy

Hi, I am using the code below to create an excel document from data
that is returned from an sql query. The formatting of the excel
document is pretty and all is good unless I hit the back button and
run my query a second time, or a third time (I haven't made it past 3
times). Basically what happens is every time I do this, excel does
not close once I hit my back button. Does anyone have a solution to
this problem? Another problem is that when I run the query it just
opens excel within my browser, is there any way to make it ask if you
want to save or open the file? Thank You.

I basically throw this code at the top of the html doc:

<%
'Change HTML header to specify Excel's MIME content type
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
%>
 
S

SPA

Hi

For your second problem, you could probably have a script code:

<SCRIPT Language="Javascript">
var resp;
resp = confirm("Do you want to open Excel file?");
if (resp)
window.open("Excelfile.xls", "_new", "width=300, height=300,
resizable=yes");
</SCRIPT>

This will execute the opening of your excel sheet in a separate window based
on your input.

HTH
SPA
 

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

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top