Ciao di nuovo.

Ho delle difficoltà a recuperare tramite un ciclo i records di un dbase, corrispondenti ad un certo criterio ed a esportarli in formato excel; in pratica lo script esportato in excel non recupera nulla.
Questo è il codice e vi ringrazio anticipatamente per l'attenzione e l'eventuale suggerimento:
codice:
nomefile=replace(nome," ","_")

set fso = createobject("scripting.filesystemobject")
Set act = fso.CreateTextFile(server.mappath("public/"& nomefile & "-"& day(date())& month(date())& year(date()) &".xls"), true)

act.WriteLine "<html xmlns:x=""urn:schemas-microsoft-com:office:excel"">"
act.WriteLine "<head>"
act.WriteLine "<!--[if gte mso 9]><xml>"
act.WriteLine "<x:ExcelWorkbook>"
act.WriteLine "<x:ExcelWorksheets>"
act.WriteLine "<x:ExcelWorksheet>"
act.WriteLine "<x:Name>"& nomefile &"</x:Name>"
act.WriteLine "<x:WorksheetOptions>"
act.WriteLine "<x:Print>"
act.WriteLine "<x:ValidPrinterInfo/>"
act.WriteLine "</x:Print>"
act.WriteLine "</x:WorksheetOptions>"
act.WriteLine "</x:ExcelWorksheet>"
act.WriteLine "</x:ExcelWorksheets>"
act.WriteLine "</x:ExcelWorkbook>"
act.WriteLine "</xml>"
act.WriteLine "<![endif]--> "
act.WriteLine "</head>"

sql = "SELECT * FROM TABELLASQL WHERE ID_NOME = "& NOME0 &" order by id"

set rs = server.createObject("ADODB.Recordset")
rs.open sql, cn, 1, 3
	
if rs.eof then
response.write ("kO") & "
"
else
While Not rs.eof	
	
act.WriteLine "<body>"
act.WriteLine "<table>"
act.WriteLine "<tr>"
act.WriteLine "<td>"
act.WriteLine "NOME:"
act.WriteLine "<td>"
act.WriteLine rs("NOME")

act.WriteLine "</td>"
act.WriteLine "</table>"
act.WriteLine "</body>"
act.WriteLine "</html>"
	
rs.MoveNext
wend

end if
rs.close
cn.close
set rs = nothing
set cn = Nothing