S
Sylvain
Guest
Bonjour,
comme c'est dit dans le titre : suivre l'avancement du travail d'une boucle for next en utilisant la barre d'état. Dernière version avec estimation du temps restant. Toute amélioration est bienvenue.
Le code :
Sub progression(texte_à_afficher As String, nombre_total_de_boucles As Integer, boucle_en_cours As Integer, Optional t_départ As Single = 0)
'réalisé par Sylvain code commenté sur
'<http://sn1.chez.tiscali.fr/presentation/progression.htm>
Dim i As Integer, t_restant As Single, mn As Single, estimé As String
i = boucle_en_cours
If i >= nombre_total_de_boucles Or nombre_total_de_boucles = 0 Then
Application.StatusBar = False
Else
If t_départ = 0 Or i = 1 Then
'pas d'affichage du temps restant
estimé = ""
Else
estimé = " temps restant estimé "
t_restant = (Timer - t_départ) / (i - 1) * (nombre_total_de_boucles - i + 1)
mn = Int(t_restant / 60) 'calcul du nombre de minutes
If mn > 0 Then
t_restant = t_restant - mn * 60 'secondes
estimé = estimé + FormatNumber(mn, 0)
End If
estimé = " temps restant estimé " + FormatNumber(t_restant, 1) + " s"
End If
i = Round(11 - i / nombre_total_de_boucles * 10, 0)
Application.StatusBar = texte_à_afficher + " " + Mid("++++++++++----------", i, 10) + estimé
End If
End Sub
A+ (ça c'est pas dans le code)
comme c'est dit dans le titre : suivre l'avancement du travail d'une boucle for next en utilisant la barre d'état. Dernière version avec estimation du temps restant. Toute amélioration est bienvenue.
Le code :
Sub progression(texte_à_afficher As String, nombre_total_de_boucles As Integer, boucle_en_cours As Integer, Optional t_départ As Single = 0)
'réalisé par Sylvain code commenté sur
'<http://sn1.chez.tiscali.fr/presentation/progression.htm>
Dim i As Integer, t_restant As Single, mn As Single, estimé As String
i = boucle_en_cours
If i >= nombre_total_de_boucles Or nombre_total_de_boucles = 0 Then
Application.StatusBar = False
Else
If t_départ = 0 Or i = 1 Then
'pas d'affichage du temps restant
estimé = ""
Else
estimé = " temps restant estimé "
t_restant = (Timer - t_départ) / (i - 1) * (nombre_total_de_boucles - i + 1)
mn = Int(t_restant / 60) 'calcul du nombre de minutes
If mn > 0 Then
t_restant = t_restant - mn * 60 'secondes
estimé = estimé + FormatNumber(mn, 0)
End If
estimé = " temps restant estimé " + FormatNumber(t_restant, 1) + " s"
End If
i = Round(11 - i / nombre_total_de_boucles * 10, 0)
Application.StatusBar = texte_à_afficher + " " + Mid("++++++++++----------", i, 10) + estimé
End If
End Sub
A+ (ça c'est pas dans le code)