M
Membre supprimé 173553
Guest
Bonjour,
j'aurais besoin de votre aide à propos de Listview excel 2007. Dans le code ci-dessus les colonnes apparaissent correctement mais pas moyen d'afficher les lignes du dossier "C:\windosw\tasks" D'avance merci.
[Code:
' VB Script Document
Private Sub UserForm_Initialize()
Dim fso As Object
Dim fldr As Object
Dim Files As Object
Dim oFile As Object
Dim li As ListItem
On Error GoTo ErrHandler
'Définit les entêtes de colonnes
With ListView1
With .ColumnHeaders
.Clear 'Supprime les anciens entêtes
'Ajout des colonnes
.Add , , "Name", 80
.Add , , "Schedule", 50, lvwColumnLeft
.Add , , "Status", 60, lvwColumnRight
.Add , , "Last Run Time", 60, lvwColumnCenter
.Add , , "Next Run Time", 60, lvwColumnCenter
.Add , , "Owner", 60, lvwColumnCenter
End With
.View = lvwReport 'affichage en mode Rapport
.Gridlines = True 'affichage d'un quadrillage
.FullRowSelect = True 'Sélection des lignes comlètes
End With
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder("c:\windows\tasks\") '// Change to suit...
Set Files = fldr.Files
For Each oFile In Files
Set li = ListView1.ListItems.Add(, , oFile.Name)
li.SubItems(1) = oFile.Schedule
li.SubItems(2) = oFile.Status
li.SubItems(3) = Format$(oFile."Last Run Time", "DD MMM YYYY")
li.SubItems(4) = Format$(oFile."Next Run Time", "DD MMM YYYY")
li.SubItems(5) = oFile.Owner
Next
EndProc:
On Error Resume Next
Set li = Nothing
Set oFile = Nothing
Set fldr = Nothing
Set fso = Nothing
Exit Sub
ErrHandler:
MsgBox "ERROR: " & Err.Description, vbexclmation, "Error"
Resume EndProc
End Sub
]
j'aurais besoin de votre aide à propos de Listview excel 2007. Dans le code ci-dessus les colonnes apparaissent correctement mais pas moyen d'afficher les lignes du dossier "C:\windosw\tasks" D'avance merci.
[Code:
' VB Script Document
Private Sub UserForm_Initialize()
Dim fso As Object
Dim fldr As Object
Dim Files As Object
Dim oFile As Object
Dim li As ListItem
On Error GoTo ErrHandler
'Définit les entêtes de colonnes
With ListView1
With .ColumnHeaders
.Clear 'Supprime les anciens entêtes
'Ajout des colonnes
.Add , , "Name", 80
.Add , , "Schedule", 50, lvwColumnLeft
.Add , , "Status", 60, lvwColumnRight
.Add , , "Last Run Time", 60, lvwColumnCenter
.Add , , "Next Run Time", 60, lvwColumnCenter
.Add , , "Owner", 60, lvwColumnCenter
End With
.View = lvwReport 'affichage en mode Rapport
.Gridlines = True 'affichage d'un quadrillage
.FullRowSelect = True 'Sélection des lignes comlètes
End With
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder("c:\windows\tasks\") '// Change to suit...
Set Files = fldr.Files
For Each oFile In Files
Set li = ListView1.ListItems.Add(, , oFile.Name)
li.SubItems(1) = oFile.Schedule
li.SubItems(2) = oFile.Status
li.SubItems(3) = Format$(oFile."Last Run Time", "DD MMM YYYY")
li.SubItems(4) = Format$(oFile."Next Run Time", "DD MMM YYYY")
li.SubItems(5) = oFile.Owner
Next
EndProc:
On Error Resume Next
Set li = Nothing
Set oFile = Nothing
Set fldr = Nothing
Set fso = Nothing
Exit Sub
ErrHandler:
MsgBox "ERROR: " & Err.Description, vbexclmation, "Error"
Resume EndProc
End Sub
]