Tuesday, October 5, 2010

Read the Value from the Notepad

Call ReadNotepad(oBjmyfile,oBjFileLocation,Trn,oBjAmtDate)
Public Function ReadNotepad(oBjmyfile,oBjFileLocation,Trn,oBjAmtDate)
                                    Const ForReading = 1, ForWriting = 2
                                    myfile = "!!" & Space(1) & "REF" & Space(1) & oBjmyfile
                                    Set FSOj = CreateObject("Scripting.FileSystemObject")
                                    Set oFRead = FSOj.OpenTextFile(oBjFileLocation,ForReading,True)
                                    Do until oFRead.AtEndOfStream
                                    oFRd = oFRead.Readline()
                                    MyValue1 = strcomp(oFRd,myfile,0)
                                    If Myvalue1 = 0  Then
                                                Do until oFRead.AtEndOfStream
                                                mysubfileread = oFRead.Readline()
                                                            If left(mysubfileread,4) = ":20:"  Then
                                                                        values = split(mysubfileread,":")
                                                                        Trn=values(2)
                                                                        For i=0 to 5
                                                                                    Secondvalue = oFRead.ReadLine()
                                                                                    trimSecondvalue = trim(Secondvalue)
                                                                        If left(trimSecondvalue,5) = ":32A:"  Then
                                                                                    values1 = split(trimSecondvalue,":")
                                                                                    oBjAmtDate=values1(2)      
                                                                        Exit do
                                                                        End If
                                                                        elseIf left(trimSecondvalue,5) = ":32B:"  Then
                                                                                    values2 = split(trimSecondvalue,":")
                                                                                    oBjAmtDate=values2(2)      
                                                                        Exit do
                                                                        End If
                                                                        Next
                                                                        Exit do
                                                                        Exit do
                                                            End if
                                                Loop                                                                                                                            
                                    End If
                                    Loop
End Function

No comments: