![sobolsoft excel export to multiple text files sobolsoft excel export to multiple text files](https://s.softdeluxe.com/screenshots/637/637783_1_pad_.jpg)
![sobolsoft excel export to multiple text files sobolsoft excel export to multiple text files](https://media.pcwin.com/images/screen/57170-excel_import_multiple_text_files_software.jpg)
Using Application.Trim and Split to separate the columns. Slot No." _Ĭase InStr(TextLine, "(Number of results = ") = 1ĭata(10, c) = Trim(Mid(TextLine, 35, 16)) RowLabels(3) = ("O&M " & Mid(TextLine, 8))ĮlseIf InStr(TextLine, "MML Session") > 0 ThenĮlseIf InStr(TextLine, "RETCODE = ") = 1 ThenĮlseIf InStr(TextLine, "Cabinet No. Line Input #FileNum, TextLine 'read a lineĮlseIf InStr(TextLine, "Report : +++ ") = 1 Then Open (FolderPath & FileName) For Input As FileNum Cells(.unt, dCol).End(xlUp).Offset(1)ĭim FileName As String: FileName = Dir(FolderPath & FilePattern)
![sobolsoft excel export to multiple text files sobolsoft excel export to multiple text files](https://forums.autodesk.com/autodesk/attachments/autodesk/101/80767/1/ris1.png)
Currently, it takes about 6 seconds for the file provided on my machine.Ĭonst FilePattern As String = "*.txt" ' or rather "VSWR W5*.txt"ĭim wb As Workbook: Set wb = ThisWorkbook Make sure you don't exceed the 1048576 Excel rows limit. Note that this will generate over 125.000 lines for the file you provided.idx = InStr(textline, "Cabinet No.")Īnd my desired output should be like this Output
Sobolsoft excel export to multiple text files how to#
Nextrow = nextrow + 1 'now move to next rowĪlmost successful but the only problem is i can't seem to figure out how to make this line split the data into 5 separate columns. 'nextrow = nextrow + 1 'now move to next rowĪctiveSheet.Cells(nextrow, "G").Value = Mid(textline, filenum + 1) 'ActiveSheet.Cells(nextrow, "A").Value = Mid(textline, idx + 5)ĪctiveSheet.Cells(nextrow, "A").Value = Mid(textline, filenum + 5)ĪctiveSheet.Cells(nextrow, "B").Value = Right(textline, filenum + 19)ĪctiveSheet.Cells(nextrow, "C").Value = ("O&M" & Mid(textline, filenum + 4))ĪctiveSheet.Cells(nextrow, "D").Value = "DSP VSWR: "ĪctiveSheet.Cells(nextrow, "E").Value = "0"ĪctiveSheet.Cells(nextrow, "F").Value = Mid(textline, filenum + 12) Nextrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 I once asked at Vbscript extract data from Text File into Excelīut after trying for few weeks and still no success so I use vba instead.ĭim filename As String, nextrow As Long, MyFolder As Stringĭim MyFile As String, text As String, textline As String, filedate As String I need to extract data from text file into Excel file.