Saturday 29 August 2015

Returns text from a file that starts with certain text..

' This is used to retrive the lines that start with with "Function"..

Dim fso
Dim rline, wline
Dim spath1, spath2
spath1="C:\Users\venu\Desktop\filesrea\Func7up.txt"
spath2="C:\Users\venu\Desktop\filesrea\func7up_func names.txt"
str3="Function"


Set fso = CreateObject("Scripting.FileSystemObject")
Set file1=fso.OpenTextFile(spath1, 1, false)
Set file2=fso.OpenTextFile(spath2, 8, true)
file2.Write ""
Do while file1.AtEndOfStream<>true
    str1= file1.ReadLine
    If str1<>"" Then
        intfound= Instr(1, str1, str3, 1)
        If intfound=1 Then
            file2.WriteLine(str1)
        End If
    End If
Loop

file1.Close
file2.Close
Set fso=Nothing
msgbox "Finally implemented"

No comments:

Post a Comment