D'impression listview

mido21

XLDnaute Nouveau
bonjour a tous
Je vous serais obligé de corriger code suivant
Code:
Sub print_report()
With Application: .EnableEvents = False: .Calculation = xlManual: .ScreenUpdating = False: End With
Dim xlApp As Excel.Application, xlBook As Excel.Workbook
Dim ListData(), xlSheet As Excel.Worksheet
Dim rep As String, i As Integer, j As Integer
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    rep = ActiveWorkbook.Path & "\Export"
    If Not ExisteRep(rep) Then MkDir rep
    Set xlApp = CreateObject("Excel.Application")
    Set xlBook = xlApp.Workbooks.Add: Set xlSheet = xlBook.Worksheets(1)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
   
    xlSheet.Range("a4").Resize(, 9).Interior.Color = RGB(55, 210, 45)
    xlSheet.Range("c2") = "ßÔÝ ÍÓÇÈ //" & Me.n1.Value
    xlSheet.Range("a2:i2").Merge
      ListData() = Me.ListView1.ListItems.Item: i = ListView1.ListItems.Count: j = ListView1.ListItems.ColumnCount
      xlSheet.Range("a5").Resize(i, j).Value = ListData()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Lrw = xlSheet.Range("a" & Rows.Count).End(xlUp).Row
        xlSheet.Range("b" & Lrw + 1) = "total"
        xlSheet.Cells(Lrw + 1, 4) = WorksheetFunction.Sum(xlSheet.Range(Cells(5, "d").Address, xlSheet.Cells(Lrw, "d").Address))
        xlSheet.Cells(Lrw + 1, 5) = WorksheetFunction.Sum(xlSheet.Range(Cells(5, "e").Address, xlSheet.Cells(Lrw, "e").Address))
        xlSheet.Range(Cells(Lrw + 1, "b").Address, Cells(Lrw + 1, "i").Address).Interior.ThemeColor = xlThemeColorAccent6
        xlSheet.Cells(Lrw + 1, "b") = Format(xlSheet.Cells(Lrw + 1, "b"), "yyyy/mm/dd")
   With xlSheet.Range("a2:i" & Lrw + 1)
        .Borders.LineStyle = xlContinuous = 1: .Font.Name = "ööArial": .Font.Size = 12: .Font.Bold = True
        .HorizontalAlignment = xlCenter: .ReadingOrder = xlRTL: .EntireColumn.AutoFit
        End With
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    xlBook.SaveAs rep & "/" & Me.n1.Value & Format(Now, "dd-mm-yyyy_hh_mm") & ".xlsx"
    xlApp.Visible = True: Set xlSheet = Nothing: Set xlBook = Nothing: Set xlApp = Nothing  'xlApp.Quit
With Application: .EnableEvents = True: .Calculation = xlAutomatic: .ScreenUpdating = True: End With
    End Sub
===========================
L'erreur ici
Code:
 ListData() = Me.ListView1.ListItems.Item: i = ListView1.ListItems.Count: j = ListView1.ListItems.ColumnCount
      xlSheet.Range("a5").Resize(i, j).Value = ListData()
 

Statistiques des forums

Discussions
314 647
Messages
2 111 533
Membres
111 197
dernier inscrit
john49