hi
i have this code that reads a txt file of mind
works fine it does what i want it read the two coulmns from txt file and puts it into excel sheet.Code:Dim oExcel As Object Dim oBook As Object Dim oRow As Int16 = 0 oExcel = CreateObject("Excel.Application") oBook = oExcel.Workbooks.Add 'Read input .txt file line-by-line, Copy to Clipboard & Paste to Excel Using rdr As New System.IO.StreamReader("C:\Users\rr154237\Desktop\AccInfo.txt") Do While rdr.Peek() >= 0 Dim InputLine As String = rdr.ReadLine oRow = oRow + 1 System.Windows.Forms.Clipboard.SetDataObject(InputLine) oBook.Worksheets(1).Range("A" + oRow.ToString).Select() oBook.Worksheets(1).Paste() Loop rdr.Close() End Using oExcel.Visible = True oExcel.save("C:\Users\rr154237\Desktop\test.xls") oBook = Nothing oExcel.Quit() oExcel = Nothing
what i need to do with this code is a dd a column header to column c say value is the header and i want to add in number to the excel file.
for example lets say i want all values to be set to 0.00
it wont be in txt file ever so how can i get it to add to excel sheet from the code i have done so far




Reply With Quote