Option Explicit
Dim arr
Private Sub Command1_Click()
Dim i As Long
For i = 0 To UBound(arr)
If InStr(arr(i), Text1) = 1 Then '查到就退出,可以装入数组
MsgBox arr(i)
Exit For
End If
Next
If i = UBound(arr) + 1 Then MsgBox "未查到:" & Text1
End Sub
Private Sub Form_Load()
If Dir("c:\1.txt") <> "" Then
Open "c:\1.txt" For Input As #1
arr = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbNewLine)
Close #1
Else
MsgBox "为找到文件:" & "c:\1.txt"
Unload Me
End If
Text1 = "yu212.exe"
End Sub
温馨提示:答案为网友推荐,仅供参考