Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copying only required string from txt file to excel sheet
Hi ,
i am preparing one report in excel sheet. For which i got txt file as input. Which contains some strings. but, my interest is in particular format of string or line. For example File name - tst.txt L1 - return (&SUP_GPTA_TC_GROUP[channel].TCCTRL_reg); L2 - D:\p\S83\C01\iiii\zzz\00\XXX\yyy.h 2423 Info 826: Suspicious pointer-to-pointer conversion (area too small) <D.23: Use pointers as declared (EXPR) |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copying only required string from txt file to excel sheet
Sub Gettext()
Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Set fsread = CreateObject("Scripting.FileSystemObject") FName = Application.GetOpenFilename("All files (*.*),*.*") Set fread = fsread.GetFile(FName) Set tsread = fread.OpenAsTextStream(ForReading, TristateUseDefault) RowCount = 1 Do While tsread.AtEndOfStream = False InputLine = tsread.ReadLine If InStr(InputLine, "D:\p\S83\") 0 Then Range("A" & RowCount) = InputLine RowCount = RowCount + 1 End If Loop tsread.Close End Sub "sangram" wrote: Hi , i am preparing one report in excel sheet. For which i got txt file as input. Which contains some strings. but, my interest is in particular format of string or line. For example File name - tst.txt L1 - return (&SUP_GPTA_TC_GROUP[channel].TCCTRL_reg); L2 - D:\p\S83\C01\iiii\zzz\00\XXX\yyy.h 2423 Info 826: Suspicious pointer-to-pointer conversion (area too small) <D.23: Use pointers as declared (EXPR) . . . I want only line L2 ( or lines containing pattern D:\p\S83\ ) to be copied from tst.txt file to excelsheet. Can you suggest me way to do this using excelsheet programming. Thanks in advance sangram |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copying a date into a text string | Excel Worksheet Functions | |||
How to disallow a sheet or file from copying by other users | Excel Discussion (Misc queries) | |||
Excel converts string in CSV file as number | Excel Discussion (Misc queries) | |||
How can I transfer a required data from sheet 1 to sheet 2 automat | Excel Discussion (Misc queries) | |||
variable text value within string formula required to sum column | Excel Worksheet Functions |