Set TextObj = FileObj.OpenTextFile(strPath)
Do While Not TextObj.AtEndOfStream
Dim Line$, DateStr$, Curentdatestr$, Datecountstr$
Line = TextObj.ReadLine
Curentdatestr = Left(Line, 10)
'MsgBox "Curentdatestr : " & Curentdatestr
'On Error GoTo here
On Error GoTo errHandler
d = CDate(Curentdatestr)
If Not DateStr Like Curentdatestr Then
cnt1 = 0
cnt2 = 0
DateStr = Curentdatestr
ii = ii + 1
End If
If InStr(Line, Target1) Then
If InStr(Line, Target3) Then
cnt1 = cnt1 + 1
End If
End If
If InStr(Line, Target2) Then
If InStr(Line, Target3) Then
cnt2 = cnt2 + 1
End If
End If
Datecountstr = DateStr & ":" & cnt1 & ":"
VBA 巧用 On Error GoTo,Exit Function/Exit Sub,Resume
最新推荐文章于 2021-08-28 12:59:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)