![在文件中查找列中列出的字符串,并在相应的文件名列中标记是或否](https://linux22.com/image/1542163/%E5%9C%A8%E6%96%87%E4%BB%B6%E4%B8%AD%E6%9F%A5%E6%89%BE%E5%88%97%E4%B8%AD%E5%88%97%E5%87%BA%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2%EF%BC%8C%E5%B9%B6%E5%9C%A8%E7%9B%B8%E5%BA%94%E7%9A%84%E6%96%87%E4%BB%B6%E5%90%8D%E5%88%97%E4%B8%AD%E6%A0%87%E8%AE%B0%E6%98%AF%E6%88%96%E5%90%A6.png)
答案1
我得到了答案地点。一切如预期般运转。
Sub Demo_StringSearch_txt()
Dim fPath As String: fPath = "C:\test\search\"
Dim strContent As String
Dim intFF As Integer: intFF = FreeFile()
Dim myArr
Dim i As Long, j As Long
myArr = Range("A1", Cells(Cells(Rows.count, 1).End(xlUp).Row, Cells(1, Columns.count).End(xlToLeft).Column)).Value
For i = 2 To UBound(myArr, 2)
Open fPath & myArr(1, i) For Input As #intFF
strContent = Input(LOF(intFF), intFF)
Close #intFF
For j = 2 To UBound(myArr)
If InStr(strContent, myArr(j, 1)) > 0 Then
myArr(j, i) = "Yes"
End If
Next
Next
Range("A1").Resize(UBound(myArr), UBound(myArr, 2)) = myArr
End Sub