![]()
Sub Import_Node_Text() Dim fs, fil, cur_line, s_name, row_count Set fs = CreateObject("Scripting.filesystemobject") Set fil = fs.opentextfile("E:\data.txt") Do On Error GoTo end_file row_count = 1 Sheets.Add After:=Sheets(Sheets.Count) Range("A" & row_count) = cur_line row_count = 2 Do Until Strings.Left(cur_line, 9) = "Node Name" cur_line = fil.readline Range("A" & row_count) = cur_line row_count = row_count + 1 Loop s_name = Strings.Left(cur_line, InStr(1, cur_line, "Board ID") - 10) s_name = Replace(s_name, "Node Name : ", "") ActiveSheet.Name = Replace(s_name, " ", "") Do cur_line = fil.readline If Strings.Left(cur_line, 5) = "Daily" Then Exit Do Range("A" & row_count + 1) = cur_line row_count = row_count + 1 Loop Loop Exit Sub end_file: End Sub
Bookmarks