Private Sub Command1_Click() Dim strTemp As String, fPath As String, strFind As String, intPos As Long fPath = App.path & "\GGG.txt" strTemp = Space(FileLen(fPath)) Open fPath For Binary As #1 Len = FileLen(fPath) Get #1, 1, strTemp Close #1
strFind = "哪一个" intPos = InStr(strTemp, strFind) If intPos <> 0 Then MsgBox Chr(34) & strFind & """的位置在" & intPos Else MsgBox Chr(34) & strFind & """ 没找到!" End If End Sub
Dim strTemp As String, fPath As String, strFind As String, intPos As Long
fPath = App.path & "\GGG.txt"
strTemp = Space(FileLen(fPath))
Open fPath For Binary As #1 Len = FileLen(fPath)
Get #1, 1, strTemp
Close #1
strFind = "哪一个"
intPos = InStr(strTemp, strFind)
If intPos <> 0 Then
MsgBox Chr(34) & strFind & """的位置在" & intPos
Else
MsgBox Chr(34) & strFind & """ 没找到!"
End If
End Sub