Sub crea_file_INSERZ_HTML()
Dim fso As FileSystemObject
Dim fsoR As FileSystemObject
Dim stream As TextStream
Dim strFileName As String
Dim objTextStream
Dim tabella As String
Const fsoForReading = 1
' Create a FileSystemObject.
For i = 1 To 10000
tabella = ""
If Trim(Cells(i, "A")) <> "" Then
Set fso = New FileSystemObject
' Create a TextStream.
Set stream = fso.CreateTextFile("C:UsersPeppuDesktopDG BIKEEBAYFile CSVAFAM Pignoni" & i & ".html", True)
Set fsoR = New FileSystemObject
If fsoR.FileExists(Trim(Cells(i, "H"))) Then
'The file exists, so open it and output its contents
Set objTextStream = fsoR.OpenTextFile(Trim(Cells(i, "H")), fsoForReading)
tabella = objTextStream.ReadAll
objTextStream.Close
Set objTextStream = Nothing
End If
'Clean up
Set fsoR = Nothing
stream.Write Trim(Cells(i, "A")) & _
Trim(Cells(i, "B")) & _
Trim(Cells(i, "C")) & _
Trim(Cells(i, "D")) & _
Trim(Cells(i, "E")) & _
Trim(Cells(i, "F")) & _
Trim(Cells(i, "G")) & _
Trim(Cells(i, "h")) & _
Trim(Cells(i, "I")) & _
Trim(Cells(i, "J")) & _
Trim(Cells(i, "K")) & _
Trim(Cells(i, "L")) & _
Trim(Cells(i, "M")) & _
Trim(Cells(i, "N")) & _
Trim(Cells(i, "O")) & _
Trim(Cells(i, "P")) & _
Trim(Cells(i, "Q")) & _
Trim(Cells(i, "R")) & _
Trim(Cells(i, "S")) & _
Trim(Cells(i, "t")) & _
Trim(Cells(i, "u")) & Trim(Cells(i, "v")) & Trim(Cells(i, "w")) & Trim(Cells(i, "x")) & Trim(Cells(i, "y")) & Trim(Cells(i, "z")) & Trim(Cells(i, "aa")) & Trim(Cells(i, "ab")) & Trim(Cells(i, "ac"))
'stream.Write "This line uses the Write method."
stream.Close
End If
Next
End Sub |