subProverka: Dim fs As New Scripting.FileSystemObject If fs.FileExists(ReadIniValue(App.Path & "\METMG.ini", "Parametri", "PatekaPDF") & strXLS) Then strfile = Dir(Putanja & strXLStmp & "*" & extenzija) While strfile <> "" If strfile <> strXLStmp & extenzija Then ' da preskoci fajl koji nama broj u zagradi inace pravi gresku trenutni = Left(strfile, Len(strfile) - 5) trenutni = Right(trenutni, Len(trenutni) - 5) If IsNumeric(trenutni) Then broj = CInt(trenutni) If (broj >= brojac) Then brojac = broj + 1 End If End If End If strfile = Dir() Wend Putanja = Putanja & strXLStmp & "(" & brojac & ")" & extenzija End If