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

Closing window after exporting to Excel 1

Status
Not open for further replies.

soulpumpkin

Programmer
Feb 18, 2005
79
0
0
US
I have a page that opens and writes out it's contents to excel, but after the that it remains open and is a blank popup.

How would I close that page after the excel export is completed?

Soul Pumpkin
 
Here is the code that calls the page to be exported:
Code:
	function exportToExcel(classID){
    	var windowLeft = (window.screen.width / 2) - 300;
		var windowTop = (window.screen.height / 2) - 450;
		var PopUp = window.open("export_sim_dev.asp?ClassID=" + classID, "Export", "height=500,width=700,scrollbars=no,toolbar=no,menubar=yes,location=no,status=no,left=" + windowLeft + ",top=" + windowTop);
		PopUp.focus();
		return false;
	}

And the page that opens has the following at the top:
Code:
	strDate = Date()
	strDate = Replace(strDate, "/", "-")
	Response.ContentType = "application/vnd.ms-excel"
    Response.AddHeader "Content-Disposition", "attachment; filename=" & rs("ProductName") & " - " & Request.QueryString.Item("ClassID") & " - " &  strDate & ".xls"

After the export to excel process is complete, the popup page that is blank stays up. I need to close that, or only show the save dialog without the popup window. I tried using window.close as well as me.close, but they both end up closing the window before the export process is done.

Any help would be great.

Soul Pumpkin
 
I'm not familiar with iframes, but I'll look into it. THanks

Soul Pumpkin
 
That worked perfectly. Thank you so much!

Soul Pumpkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top