Dim sText As String
Dim intFileNum As Integer
Dim sText As String
If Form3.Text1.Text = "" Then
'On Error GoTo 1 (This is very bad practice)
With CD1
.DialogTitle = "Open Name File"
.Filter = "All Supported Types|*.usr;*.txt;*.dat|"
.ShowOpen
intFileNum = FreeFile
On Error Resume Next
Open .FileName For Input As #intFileNum
While Not EOF(intFileNum)
Input #intFileNum, sText$
If sText$ = "" Then
Exit Sub
Else
List1.AddItem sText$
DoEvents
End If
Wend
Close #intFileNum
End With
Else
If Check1.Value = vbChecked Then
With CD1
.DialogTitle = "Open Name File"
.Filter = "All Supported Types|*.usr;*.txt;*.dat|"
.ShowOpen
intFileNum = FreeFile
On Error Resume Next
Open .FileName For Input As #intFileNum
While Not EOF(intFileNum)
Input #intFileNum, sText$
If sText$ = "" Then
Exit Sub
Else
List1.AddItem sText$
DoEvents
End If
Wend
Close #intFileNum
End With
End If
End If
Label1.Caption = "Word's: " & List1.ListCount