Dim ffilet Dim fname Dim fs Dim a Dim b fname = "testt.txt" Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.OpenTextFile(fname) Do While a.AtEndOfStream <> True if a.ReadLine = "end" Then break 'end is found ok procceed else Set b = fs.OpenTextFile("log.txt", 8) b.WriteLine("File: " + fname + " failed") msgbox "End not found, read log.txt" end if Loop a.close b.close