Misc Vars
Dim iRow As Integer = 1
Dim x As Integer = 0
Dim y As Integer = 0
Get the Excel Application ready
Dim xlApp As Excel.Application
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlApp.Visible = True
xlApp.DisplayAlerts = False
Get the Excel Workbook ready
Dim xlBook As Excel.Workbook
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
Get the Excel WorkSheet ready
Dim xlSheet As New Excel.Worksheet
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
This is where you would get the file names, and
add them to some sort of a list or array
Dim strFiles() As String = {"FILE1", "FILE2", "FILE3"}
For each file...
For x = 0 To strFiles.Length - 1
Add the file name to the WorkSheet
xlSheet.Cells(iRow, 1) = strFiles(x)
This is where you would read the lines of the file, and
add them to some sort of a list or array
Dim strFileLines() As String = {"Line 1", "Line 2", "Line 3"}
For each line...
For y = 0 To strFileLines.Length - 1
Add the file name to the WorkSheet
xlSheet.Cells(iRow, 2) = strFileLines(y)
Set the next row
iRow += 1
Next
Add an empty row after each file
iRow += 1
Next
Cleanup...
xlSheet = Nothing
xlBook.SaveAs("c:\test.xls")
xlBook.Save()
xlBook.Close()
xlBook = Nothing
xlApp.Quit()
xlApp = Nothing