下面得代码是找出文件中某一行中的某一段字段的方法,以这个为基础再来做解决你的问题,就非常容易了,自己解决一下吧!
Private Sub cmdFind_Click()
Dim b(1 To 5000) As String
Dim intFileNum As Integer
Dim strFile As String
Dim strBridge As String
Dim intI As Integer
Dim intJ As Integer
b(1) = "123456"
b(2) = "123456789"
b(3) = "01234567890"
intJ=1
intFileNum = FreeFile
Open App.Path & "\Test.txt" For Input As intFileNum
Do While Not EOF(intFileNum)
Line Input #intFileNum, strFile
strBridge = Right(strFile, Len(strFile) - 10)
strBridge = Left(strBridge , 11)
For intI = 1 To UBound(b)
If b(intI) = strBridge Then
MsgBox "The string'" & strBridge & "' of line "& intJ &" is found in b("& intI &")"
End If
Next intI
intJ=intJ+1
Loop
Close intFileNum
End Sub
还有一种方法做起来应该要简单得多,就是使用: 正则表达式.不过正则表达式我不是很熟,你学习一下正则表达式,这个问题应该很容易就解决了!!
[此贴子已经被作者于2007-1-25 10:08:36编辑过]