|
-
May 25th, 2004, 08:43 PM
#1
Thread Starter
Junior Member
Text (.txt) question, please view
hi, i need to make a VB program which will open a text file (Names.txt), and delete all the words after the character ":", and also remove every second line...like:
Before
Adrian : bla bla bla bla
Asllani : tri li la
After
Adrian
Asllani
....
please someone give me some ideas...on how to go about doing this...thanks....
-
May 25th, 2004, 09:24 PM
#2
Frenzied Member
how about
VB Code:
Option Explicit
Dim myArray() As String
Dim strString
Dim strString2
Private Sub Form_Load()
Open "c:\temp\Names.txt" For Input As #1
Do While Not EOF(1)
Input #1, strString
If strString <> "" Then
myArray = Split(strString, ":")
strString2 = strString2 & myArray(0) & vbCrLf
End If
Loop
Close #1
Open "c:\temp\results.txt" For Output As #1
Print #1, strString2
Close #1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|