Opening an excel file in ColdFusion 8

onaled777 used Ask the Experts™
With the code below I am attempting to open an excel file when the submit button of a form is pressed by I keep getting a page with the following on the first line:

'); } } function writeCloseBody() { if( debugMode ) { document.write('

Can someone show me how to correct this?

<cfsetting enablecfoutputonly="Yes">
<cfparam name="publisher">	
<cfparam name="productcode">		
<cfparam name="campaign">
<cfparam name="cpa">
<cfparam name="exiturl">
<cfparam name="MOJOCreativeID">
<cfparam name="MOJOPlacementID">
<cfparam name="PageID">
<cfparam name="PageWght">
<cfparam name="CampaignCount">
<cfif isDefined("Form")>
	<cfset publisher = Form.publisher>
	<cfset product_code = Form.productcode>
	<cfset campaign_name = Form.campaign>
	<cfset cpa =>
	<cfset exit_url = Form.exiturl>
<cfcontent type="application/msexcel">
<cfheader name="Content-Disposition" value="filename=BulkCampExcel.xls">
		<table cols="2">
		<cfloop index = "LoopCount" from = "1" to = "#CampaignCount#">

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Pravin AsarPrincipal Systems Engineer
Top Expert 2005

Principal Systems Engineer
Top Expert 2005
Add "attachment; " 

Also you have option to suppress cfoutput and/or debug output

<cfsetting enablecfoutputonly="Yes">
<cfsetting showdebugoutput="false" />
<cfcontent type="application/msexcel">
<cfheader  name="Content-Disposition" value="attachment; filename=BulkCampExcel.xls">

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial