Prikazi cijelu temu 18.03.2018 22:10
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Lokacija:Ohrid Makedonija


Predmet:Re: Loop za provera naziv fajlove
evo kako sam ja resio
PreuzmiIzvorni kôd (Visual Basic):
  1.    Dim xlsBrojac As Long
  2.     Dim strXLS As String
  3.     Dim strXLStmp As String
  4.         strXLStmp = Me.cboMagacin.Text & "_" & Me.cboDobavuvac.Text & "_" & Me.txtDataOD & "_" & Me.txtDataDO & ".xls"
  5.         xlsBrojac = 0
  6.         strXLS = strXLStmp
  7.    
  8.  
  9. subProverka:
  10.     Dim fs As New Scripting.FileSystemObject
  11.         If fs.FileExists(ReadIniValue(App.path & "\METMG.ini", "Parametri", "PatekaPDF") & strXLS) Then
  12.            xlsBrojac = xlsBrojac + 1
  13.            strXLS = Left(strXLStmp, Len(strXLStmp) - 4) & "(" & xlsBrojac & ")" & ".xls"
  14.            GoTo subProverka
  15.          Else
  16.            GoTo subExcel
  17.          End If
  18.  
  19. subExcel:
  20.     Dim objExcel As Excel.Application
  21.     Dim wbk As Excel.Workbook
  22.     Dim wsh As Excel.Worksheet
  23.     Set objExcel = CreateObject("Excel.Application")
  24.     Set wbk = objExcel.Workbooks.Add
  25.     Set wsh = wbk.Worksheets("Sheet1")
  26.           wbk.SaveAs ReadIniValue(App.path & "\METMG.ini", "Parametri", "PatekaPDF") & strXLS, FileFormat:=xlExcel8
  27.                 objExcel.Quit

I ovo moe ima mane odnosno mana je u to ako neko pobise neki fajl koj je imao i zagrade neki broj
u tom slucaju program popunece to prazno mesto.