Function ProvjeraP(BrojRac As String) As String Dim temp As String Dim ImeF(1 To 2) As String Dim ImeR(1 To 2) As String Dim fs, R, F Dim Brojac As Integer Dim i As Integer Dim Putanja_Filea As String ImeR(1) = "RCP_" & BrojRac & ".XML" ' Broj rac iz polja me.Me.BROIZD + RCP_ tekst ImeR(2) = "CMD_" & BrojRac & ".ERR" Provjera1: Set fs = Application.FileSearch With fs .LookIn = PutTO .FileType = 1 If .Execute > 0 Then For i = 1 To .foundfiles.Count F = Right(.foundfiles(i), 3) If F = "XML" Then ImeF(1) = .foundfiles(i) ImeF(1) = ImeFajla(ImeF(1)) If ImeF(1) = ImeR(1) Then DoEvents Brojac = Brojac + 1 If Brojac > 3 Then GoTo Izlaz Zaustavi (Brojac) GoTo Provjera1 End If End If Next i End If End With Provjera2: Set fs = Application.FileSearch With fs .LookIn = PutFrom .FileType = 1 If .Execute > 0 Then For i = 1 To .foundfiles.Count F = Right(.foundfiles(i), 3) If F = "ERR" Then ImeF(2) = ImeFajla(.foundfiles(i)) If ImeF(2) = ImeR(2) Then Putanja_Filea = .foundfiles(i) Close #1 Open Putanja_Filea For Input As 1 Input #1, temp Close #1 MsgBox temp GoTo Kraj End If End If Next i End If End With Kraj: Exit Function Izlaz: MsgBox " Ra un nije oštampan" GoTo Provjera2 GoTo Kraj End Function