Write to & Read from Sequential Text Files

-Selva V Pasupathy, HSBC Global Resourcing, Hyderabad

Option Explicit
Dim Racf(5) As String
Private i, j, k As Integer
Private nFile As Integer
Private str, FileContent As String
Private Const FileName = "\\aphydbanhllbsd\share\Selva\WordPressLogin.vbs"
Private Sub Write_Text2Combo()
        Ref_ArrVariable
nFile = FreeFile
Open FileName For Output As #nFile
    For i = 0 To 5
    Print #nFile, Racf(i)
    Next
Close #nFile
End Sub

Private Sub Read_Text2Combo()
nFile = FreeFile
Open FileName For Input As #nFile
    Do Until EOF(nFile)
        Line Input #nFile, str
            FileContent = FileContent & vbNewLine & str
    Loop
    MsgBox FileContent
Close #nFile
End Sub

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: