Export ASP query results to Excel

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

Greetings,

Some members of my development team are having problems
exporting the results of ASP queries to Excel. For some
people, they can view the results in Excel, while other
cannot. Is there a IE configuration issue, even though all
users are accessing the same ASP page?

Any help would be appreciated.

-d
 
dave said:
Greetings,

Some members of my development team are having problems
exporting the results of ASP queries to Excel. For some
people, they can view the results in Excel, while other
cannot. Is there a IE configuration issue, even though all
users are accessing the same ASP page?

Any help would be appreciated.

-d

I had a similar problem. There is no real fix other than this (that
I've found)

Create a new page

Open the page that has your database results on it.

Cut and Paste your database results section into the new page. You
don't need the search part, just the results table.

Save this file--something like export_to_excel_yourpagename.asp works
well.

In the code view of the export_to_excel_yourpagename.asp page, after
the opening html tag, add these 2 lines:

<%Response.Clear%>
<%Response.ContentType = "application/vnd.ms-excel"%>

Save.

Close it.

This next part is cool. I found it at

http://codeproject.com/jscript/multiaction.asp

Follow the directions on that page.

Have one button post to the database result page that's currently
open. Label it as "Generate HTML
Have one button post to export_to_excel_yourpagename.asp

document.Form1.action = "Page1.asp" should read

document.Form1.action = "youroriginaldatabaseresultspagename.asp"

document.Form1.action = "Page2.asp" should read

document.Form1.action = "export_to_excel_yourpagename.asp"

When the user clicks the first button, it will run the query and
display the results as normal.

When the user clicks the second button, it will open the page with
excel in the browser window. Then the user can save/sort, etc.

This only works for XP. I'm not sure how to get it to work with
Windows 98.
 

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

Back
Top