foundFile = "" If UBound(dirLines) >= 0 Then i = 0 While i < UBound(dirLines) And foundFile = "" If InStr(1, dirLines(i), "\Archive\", vbTextCompare) = 0 Then foundFile = dirLines(i) i = i + 1 Wend End If If foundFile <> "" Then 'MsgBox "Found " & foundFile, vbInformation, "Find Product workbook" ActiveSheet.Range("A1").Value = foundFile Else MsgBox "Excel workbook with file name containing product code '" & productCode & "' not found in " & mainFolder & " and its subfolders", vbExclamation, "Find Product workbook" End If
End Sub
Synes godt om
1 synes godt om dette
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.