Grazie a te ho risolto.
Posto il codice funzionante e personalizzato; chi vuole scaricare l'eseguibile può farlo da qui:
http://www.stefan-rinke.de/articles/...ad/htmldoc.zip
codice:
<%
Function RandomPW(myLength)
Const minLength = 6
Const maxLength = 20
Dim X, Y, strPW
If myLength = 0 Then
Randomize
myLength = Int((maxLength * Rnd) + minLength)
End If
For X = 1 To myLength
Y = Int((3 * Rnd) + 1) '(1) Numeric, (2) Uppercase, (3) Lowercase
Select Case Y
Case 1
Randomize
strPW = strPW & CHR(Int((9 * Rnd) + 48))
Case 2
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 65))
Case 3
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 97))
End Select
Next
RandomPW = strPW
End Function
strPSW = RandomPW(10)
Set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & server.mappath("/mdb-database/dbx.mdb") & " ; Persist Security Info = False"
CmdeHTMLDOC = chr(34)&"d:\HTMLDOC\htmldoc.exe" &_
chr(34)& " -t pdf --quiet "& _
" --webpage -f "
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
name_fileHTML = strPSW &".html"
dir = Server.MapPath(name_fileHTML)
strSql = "SELECT * FROM TABELLA ORDER BY NAME ASC"
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open strSql, Conn, 3, 3
If Not objRs.EOF Then
set inF = FSO.OpenTextFile(dir, 2, true)
inF.write "<html><body>" &_
"<table border=""1"" width=""100%"">" &_
"<tr>" &_
"<th>ID</th>" &_
"<th>IP</th>" &_
"<th>NAME</th>" &_
"</tr>"
Do While Not objRs.EOF
inF.write "<tr>" &_
"<td>"& objRs("ID") &"</td>" &_
"<td>"& objRs("IP") &"</td>" &_
"<td>"& objRs("NAME") &"</td>"
objRs.MoveNext
Loop
inF.close
End If
set wshell = Server.CreateObject("wscript.shell")
fic_html = dir
fic_pdf = Server.MapPath(strPSW &".pdf")
fic_pdf2 = strPSW &".pdf"
wpath = CmdeHTMLDOC &chr(34)& _
fic_pdf &chr(34)&" "& chr(34)& fic_html &chr(34)
wshell.Run wpath, SW_SHOWNORMAL, true
Set wshell = nothing
objRs.Close
Set objRs = Nothing
Conn.Close
Set Conn = Nothing
%>
<script language="javascript">
alert("Registrazione eseguita correttamente: <%=fic_pdf2%>.");
window.location.href="http://localhost/public/<%=fic_pdf2%>";
</script>