Dim xlsBrojac As Long Dim strXLS As String Dim strXLStmp As String strXLStmp = Me.cboMagacin.Text & "_" & Me.cboDobavuvac.Text & "_" & Me.txtDataOD & "_" & Me.txtDataDO & ".xls" xlsBrojac = 0 strXLS = strXLStmp subProverka: Dim fs As New Scripting.FileSystemObject If fs.FileExists(ReadIniValue(App.path & "\METMG.ini", "Parametri", "PatekaPDF") & strXLS) Then xlsBrojac = xlsBrojac + 1 strXLS = Left(strXLStmp, Len(strXLStmp) - 4) & "(" & xlsBrojac & ")" & ".xls" GoTo subProverka Else GoTo subExcel End If subExcel: Dim objExcel As Excel.Application Dim wbk As Excel.Workbook Dim wsh As Excel.Worksheet Set objExcel = CreateObject("Excel.Application") Set wbk = objExcel.Workbooks.Add Set wsh = wbk.Worksheets("Sheet1") wbk.SaveAs ReadIniValue(App.path & "\METMG.ini", "Parametri", "PatekaPDF") & strXLS, FileFormat:=xlExcel8 objExcel.Quit