VB Code:
Private Sub CommandButton1_Click()
filopn1 = Application.GetOpenFilename("Text Files (*.prg), *.prg*")
If filopn1 = "" Then
MsgBox "Please select a file"
Exit Sub
End If
If UCase(Right(filopn1, 3)) <> "PRG" Then
MsgBox "This app only good for text files"
Exit Sub
End If
TextBox1.Text = filopn1
Call Make_Sections(filopn1)
End Sub
Sub Make_Sections(MyFile As Variant)
Dim OutputFile As String
Dim count As Integer
Dim MyLine As String
OutputFile = Mid$(CStr(MyFile), 1, Len(MyFile) - 3) & "doc"
Open MyFile For Input As #1
Open OutputFile For Output As #2
While Not EOF(1)
Line Input #1, MyLine
If InStr(1, MyLine, "(") <> 0 Then
Print #2, MyLine
For i = 1 To 56
Line Input #1, MyLine
Print #2, MyLine
Next i
End If
Wend
Close #1
Close #2
UserForm1.Hide
End Sub