giovedì 18 luglio 2013

vbs crea excel tramite tabella html - vbs

'

' vbs

' crea un file Excel

' utilizzando il codice html per una tabella.

'

option explicit

'

dim fs, filetxt

dim testo, contarighe



Set fs = CreateObject("Scripting.FileSystemObject")

Set filetxt = fs.CreateTextFile("c:\excel-test.xls", True)

testo ="<TABLE>"

filetxt.WriteLine(testo)

'

for contarighe = 1 to 15 step 1

testo = ""

' inizio riga

testo = testo & "<TR>"

' prima colonna - colonna A

testo = testo & "<td>" & contarighe & "</td>"

' seconda colonna - colonna B

testo = testo & "<td>" & (contarighe*2) & "</td>"

' fine riga

testo = testo & "</TR>"

filetxt.WriteLine(testo)

next

'

testo = ""

'inserisce formula Somma

testo = testo & "<TR>" ' inizio riga

testo = testo & "<td width=40><b>=sum(A1:A15)</b></td>"

testo = testo & "<td width=40><b>=sum(B1:B15)</b></td>"

testo = testo & "</TR>"

testo = testo & "</table>"

filetxt.WriteLine(testo)



filetxt.Close

'

Nessun commento:

Posta un commento