Seguo il tuo consiglio e posto il codice:
La prima parte cioe' quella di scrittura funziona...
dim excelFile
dim file
set file=CreateObject("Scripting.fileSystemObject")
mydate= date
dim nfile
nfile=split(mydate,"/")
map=server.MapPath("10.212.22.2\..\..\")
if file.FileExists(map&nfile(0)&""& nfile(1)&""&nfile(2)&".xls") then
file.DeleteFile(map&nfile(0)&""& nfile(1)&""&nfile(2)&".xls")
end if
set oExcelApplication=server.CreateObject("Excel.application")
Set oExcelBook = oExcelApplication.Workbooks.Add
Set oExcelSheet = oExcelBook.Worksheets(1)
oExcelSheet.Range("A1").Value="Release"
oExcelSheet.Range("B1").Value="Versione"
oExcelSheet.Range("C1").Value="Installatore"
oExcelSheet.Range("D1").Value="Supporto"
oExcelSheet.Range("E1").Value="Supporto_2"
oExcelSheet.Range("F1").Value="Data_inizio"
oExcelSheet.Range("G1").Value="Data_fine"
oExcelSheet.Range("H1").Value="Durata"
oExcelSheet.Range("A1:H1").Font.Bold = True
Set Conn=server.createObject("ADODB.Connection")
strConn="driver={MySQL ODBC 3.51 Driver};database=emanueleProva;UID=prova;PWD=manudb"
Conn.open strConn
dim rs
Set rs=server.createObject("ADODB.RecordSet")
dim sql
sql="select * from installazioni order by id "
rs.open sql,conn
'response.write(rs(8)" "&rs(0)&" "&rs(1)&" "&rs(2)&" "&rs(3)&" "&rs(4)&" "&rs(5)&" "&rs(6)&" "&rs(7))
oExcelSheet.Range("A2").CopyFromRecordset(rs)
set oExcelSheet=nothing
rs.Close
set rs=nothing
conn.Close
dim nomefile
nomefile=map&nfile(0)&""& nfile(1)&""&nfile(2)&".xls"
nomefile2=nfile(0)&""& nfile(1)&""&nfile(2)&".xls"
'oExcelBook.SaveAs(nomefile)
---------------------------Parte non funzionante----------------------------------
set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type= adTypeBinary
objStream.Open
objStream.LoadFromFile(nomefile)
Response.Expires = 0
Response.Buffer = true
Response.ContentType = "application/octet-stream"
Response.Addheader "Content-Disposition", "attachment; filename=" & nomefile
Response.Addheader "Content-Length", objStream.size
Response.BinaryWrite(objStream.Read(adReadAll))
objStream.Close
set objStream = nothing
set oExcelBook=nothing
oExcelApplication.quit
Set oExcelApplication=nothing
'oStream.Open()
'oStream.LoadFromFile()
'oStream.SaveToFile()
'oStream.Close
Set conn=nothing
%>
<TITLE></TITLE>
</HEAD>
<BODY bgcolor="aqua">
<center>
<h2>File esportato correttamente!</h2>
<a href="<%=nomefile%>"><h1><%=nomefile2%></h1></a>
<!--
scarica file-->
</center>
</BODY>
</HTML>