I have an export to XLS button on a page that uses the 4guysfromrolla OWC Export to Excel solution.<BR><BR>It&#039;s all working fine except for one thing. If I press the button an excel viewer is spawned and a random file is generated to display my data from the recordset. However, the data is not displayed in the excel viewer...instead the VBscript code that calls it is shown in the window. Yet, if I open the file that is created and saved into the directory upon file creation that one shows the correct data.<BR><BR>So to sum it up, window spawns, shows code instead of recordset data. Yet if I open the file that&#039;s created instead of viewing the window that automatically pops up it shows the right data.<BR><BR>Any idea what&#039;s going on? I&#039;ve included the pages code below.<BR><BR>EXPORT BUTTON CALLS THIS PAGE<BR>-----------------------------<BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;!-- #include file="../../inc/Connection.asp" --&#062;<BR>&#060;!-- #include file="../../inc/excelGenClass.asp" --&#062;<BR>&#060;%<BR> &#039;Grab the Recordset we wish to display in a spreadsheet<BR> Dim objRS, strSQL<BR> strSQL = "SELECT * FROM tblPanel"<BR> <BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open strSQL, strConn<BR><BR> &#039;Create an instance of the ExcelGen class<BR> Dim objExcel<BR> Set objExcel = New ExcelGen<BR><BR> &#039;Set the Row/Column offsets<BR> objExcel.RowOffset = 3<BR> objExcel.ColumnOffset = 1<BR><BR> &#039;Dump the recordset contents to the spreadsheet and <BR> &#039;AutoFit the columns<BR> objExcel.GenerateWorksheetFromRecordset objRS, True<BR><BR> &#039;Stream the spreadsheet to the user<BR> objExcel.StreamWorksheet<BR><BR> &#039;Clean up!<BR> Set objExcel = Nothing<BR><BR> objRS.Close<BR> Set objRS = Nothing<BR>%&#062;<BR>-----------------------------<BR>THIS IS THE EXCELGENCLASS INCLUDE FILE THAT BUILDS THE PAGE<BR>&#060;%<BR> Class ExcelGen<BR><BR> Private objSpreadsheet<BR> Private iColOffset<BR> Private iRowOffset<BR> Private strTmpDir<BR><BR> Sub Class_Initialize()<BR> Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet")<BR><BR> iRowOffset = 2<BR> iColOffset = 2<BR><BR> strTmpDir = "C:Inetpubwwwrootspreadsheets\"<BR> End Sub<BR><BR> Sub Class_Terminate()<BR> Set objSpreadsheet = Nothing &#039;Clean up<BR><BR> &#039;Remove out of date spreadsheets<BR> CleanUpSpreadsheets<BR> End Sub<BR><BR><BR> Public Property Let ColumnOffset(iColOff)<BR> If iColOff &#062; 0 then<BR> iColOffset = iColOff<BR> Else<BR> iColOffset = 2<BR> End If<BR> End Property<BR><BR> Public Property Let RowOffset(iRowOff)<BR> If iRowOff &#062; 0 then<BR> iRowOffset = iRowOff<BR> Else<BR> iRowOffset = 2<BR> End If<BR> End Property<BR><BR><BR> Sub GenerateWorksheetFromRecordset(objRS, bolAutofitColumns)<BR><BR> &#039;Populates the Excel worksheet based on a Recordset&#039;s contents<BR> &#039;Start by displaying the titles<BR> If objRS.EOF then Exit Sub<BR><BR> Dim objField, iCol, iRow, iMaxColVal<BR> iCol = iColOffset<BR> iRow = iRowOffset<BR><BR> For Each objField in objRS.Fields<BR> objSpreadsheet.Cells(iRow, iCol).Value = objField.Name<BR> objSpreadsheet.Cells(iRow, iCol).Font.Bold = True<BR> objSpreadsheet.Cells(iRow, iCol).Font.Underline = True<BR><BR> iCol = iCol + 1<BR> Next &#039;objField<BR><BR> iMaxColVal = iCol - 1<BR><BR> &#039;Display all of the data<BR> Do While Not objRS.EOF<BR> iRow = iRow + 1<BR> iCol = iColOffset<BR><BR> For Each objField in objRS.Fields<BR> If IsNull(objField.Value) then<BR> objSpreadsheet.Cells(iRow, iCol).Value = ""<BR> Else<BR> objSpreadsheet.Cells(iRow, iCol).Value = objField.Value<BR> End If<BR><BR> iCol = iCol + 1<BR> Next &#039;objField<BR><BR> objRS.MoveNext <BR> Loop<BR><BR><BR> If bolAutofitColumns then &#039;autofit columns<BR> For iCol = iColOffset to iMaxColVal<BR> objSpreadsheet.Columns(iCol).AutoFitColumns<BR> Next<BR> End If<BR> End Sub <BR><BR><BR> Function SaveWorksheet(strFileName)<BR> &#039;Save the worksheet to a specified filename<BR> On Error Resume Next<BR> Call objSpreadsheet.ActiveSheet.Export(strFileName, 0)<BR><BR> SaveWorksheet = (Err.Number = 0)<BR> End Function<BR><BR><BR> Sub StreamWorksheet()<BR> &#039;Save the worksheet in a temporary file<BR> Dim strFileName, objFSO<BR><BR> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR> strFileName = strTmpDir & objFSO.GetBaseName(objFSO.GetTempName) & ".xls"<BR> Set objFSO = Nothing<BR><BR> if SaveWorksheet(strFileName) then<BR> Response.Redirect strFileName<BR> end if<BR> End Sub<BR><BR><BR> Private Sub CleanUpSpreadsheets()<BR> Dim objFS<BR> Dim objFolder<BR> Dim objFile<BR><BR> set objFS = Server.CreateObject("Scripting.FileSystemObject")< BR> set objFolder = objFS.GetFolder(strTmpDir)<BR> <BR> &#039;Loop through each file in the strTmpDir folder<BR> for each objFile in objFolder.Files<BR> &#039;Delete Spreadsheets older than 10 minutes<BR> If DateDiff("n", objFile.DateLastModified, now) &#062; 10 then<BR> objFS.DeleteFile strTmpDir & objFile.Name, True<BR> end if<BR> next<BR><BR> set objFolder = nothing<BR> set objFS = nothing<BR> End Sub<BR><BR> End Class<BR>%&#062;