Dim strSourcePath As String, strFile As String, strDestPath As String, strLine As StringstrSourcePath = "C:\test\" strDestPath = "C:\myFiles\"strFile = Dir(strSourcePath & "*.txt") Do Until strFile = "" Open strSourcePath & strFile For Input As #1 Do Until EOF(1) Line Input #1, strLine If InStr(strLine, Text1.Text) Then Close #1 FileCopy strSourcePath & strFile, strDestPath & strFile Exit Do End If Loop Close #1 strFile = Dir() Loop
我试了下,一直报这个错 ( Line : 1 ,Char:19 Error : Expected end of statement , Code : 800A0401),麻烦大家帮我看看,谢谢
http://wapbaike.baidu.com/view/11031862.htm?ref=wise
strDestPath = "C:\myFiles\"strFile = Dir(strSourcePath & "*.txt")
Do Until strFile = ""
Open strSourcePath & strFile For Input As #1
Do Until EOF(1)
Line Input #1, strLine
If InStr(strLine, Text1.Text) Then
Close #1
FileCopy strSourcePath & strFile, strDestPath & strFile
Exit Do
End If
Loop
Close #1
strFile = Dir()
Loop