This reads a csv file from a log and puts it into an HTML table. For excel change the .html to .xls and it will read it fine.
Dim fso, InFile, OutFile, i, hold, hold_format
Set fso = CreateObject("Scripting.FileSystemObject")
Set InFile = fspenTextFile("c:\Logs\Change_DataLog0.csv",1, True)
Set OutFile = fso.CreateTextFile("C:\changes.html", True)
OutFile.WriteLine("<html><table border =1>")
Do While InFile.AtEndOfStream <> True
hold = InFile.ReadLine
hold_format = "<tr><td>"
For i = 1 To Len(hold)-1
hold = Replace(hold,Chr(34),"")
If StrComp(Mid(hold,i,1),",",1) <> 0 Then
hold_format = hold_format & Mid(hold,i,1)
Else
hold_format = hold_format & "</td><td>"
End If
Next
OutFile.WriteLine(hold_format)
hold_format = "</td></tr>"
Loop
OutFile.WriteLine("</table></html>")
InFile.Close
OutFile.Close
Dim fso, InFile, OutFile, i, hold, hold_format
Set fso = CreateObject("Scripting.FileSystemObject")
Set InFile = fspenTextFile("c:\Logs\Change_DataLog0.csv",1, True)
Set OutFile = fso.CreateTextFile("C:\changes.html", True)
OutFile.WriteLine("<html><table border =1>")
Do While InFile.AtEndOfStream <> True
hold = InFile.ReadLine
hold_format = "<tr><td>"
For i = 1 To Len(hold)-1
hold = Replace(hold,Chr(34),"")
If StrComp(Mid(hold,i,1),",",1) <> 0 Then
hold_format = hold_format & Mid(hold,i,1)
Else
hold_format = hold_format & "</td><td>"
End If
Next
OutFile.WriteLine(hold_format)
hold_format = "</td></tr>"
Loop
OutFile.WriteLine("</table></html>")
InFile.Close
OutFile.Close