Bonjour à tous,
je n'arrive pas à placer le text en vert, pour que la ListBox et la Progressbar s'exécute en m'eme temps.
Sub Installe()
Dim fs  As Object, t As Double
Dim repertoire As String, f As Object, x As Integer
Dim f1 As Object, f2 As Object
Installateur.Progressbar.Visible = True
n = 605          ' nb de fichiers à traiter
témoin = True   ' pour empêcher la fermeture du formulaire
Application.ScreenUpdating = False
Set fs = CreateObject("Scripting.FileSystemObject")
repertoire = ThisWorkbook.Path & "\Win Remix XP"
x = 1
Application.Cursor = xlNorthwestArrow
Installateur.Lbl.Caption = "Copie des fichiers en cours... Veuillez patienter."
    
For Each f In fs.GetFolder(repertoire).Files
    Cells(x, 1).Value = f.Name
    x = x + 1
Next f
x = 1
   
'For j = 1 To n
      '-- traitement fichier
'For a = 1 To 100000000: Next a   ' simulation attente
      '--------------
     ' p = p + 1 / n              ' calcul du pourcentage
      'Installateur.Progressbar.Width = p * 262
     ' DoEvents
'Next j
    'témoin = False
For Each f1 In fs.GetFolder(repertoire).SubFolders
    Cells(x, 2).Value = f1.Name
    x = x + 1
      
For Each f2 In f1.Files  ' comencement de la liste dans Listbox
        Cells(x - 1, 3).Value = f2.Name
        x = x + 1
      t = Timer + 1: Do Until Timer > t: DoEvents: Loop
Next f2
x = x - 1
Next f1
Installateur.Lbl.Caption = "Installation de Win Remix Xp..."
t = Timer + 1: Do Until Timer > t: DoEvents: Loop
Copie
Installateur.Lbl.Caption = "Vous pouvez maintenant quitter l'assistant d'installation..."
Application.ScreenUpdating = True
End Sub
Un ch'ti coup de main si you plaît. 😱
A+ 😎