我遇到错误类型不匹配。请帮忙,因为我是 VBA 宏的新手,不确定我在做什么。我只希望代码能够在搜索时选择多个文件:
Sub Main()
On Error GoTo Error:
'Open File to search
myFile = Application.GetOpenFilename(MultiSelect:=True)
bFirstLineExtract = True
bFirstLineLog = True
CellRowCounter = 2
bFound = False
'Get First Cell Value
CellValue = Cells(CellRowCounter, 1)
Do Until (CellValue = "") Or (CellValue = Null)
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1, textline
If InStr(textline, CellValue) Then
sCreateExtract
bFound = True
End If
Loop
If bFound = False Then
sCreateLog
End If
Close #1
CellRowCounter …Run Code Online (Sandbox Code Playgroud)