image_barre.Width = Int((i / nbToGo) * 100) * 3.34
'image_barre.Width = Int((i / nbToGo) * 100) * 3.34 image_barre.value = Int((i / nbToGo) * 100) * 3.34
image_barre.Width = Int((i / nbToGo) * 100 * 3.34)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionnbToGo = ListBox1.ListCount - 1à
nbToGo = ListBox1.ListCount + 1
Private Sub Cmd_PDF_Click()
Dim i As Byte
Dim nbToGo As Integer
nbToGo = ListBox1.ListCount
Application.ScreenUpdating = False
To_PDF.Height = 225.75
'boucle sur les éléments de la ListBox
compteur = 0
Progression = 0
For i = 1 To ListBox1.ListCount
compteur = compteur + 1
If ListBox1.Selected(i - 1) = True Then
feuil = ListBox1.List(i - 1) 'nom de la feuille
Sheets(feuil).Select
Progression = Progression + 1
image_barre.Width = Int((i / nbToGo) * 100) * 3.34
Label_barre.Caption = Int((i / nbToGo) * 100) & "%"
DoEvents
'On lance la conversion
ToPdf
End If
Next
Application.ScreenUpdating = True
To_PDF.Height = 249.75
End Sub
Traitée en partie...Oui... mais Non....
Private Sub Cmd_PDF_Click()
Dim i As Byte
Dim nbToGo As Integer
nbToGo = ListBox1.ListCount - 1
Application.ScreenUpdating = False
To_PDF.Height = 225.75
'boucle sur les éléments de la ListBox
compteur = 0
Progression = 0
For i = 0 To ListBox1.ListCount - 1
compteur = compteur + 1
If ListBox1.Selected(i) = True Then
feuil = ListBox1.List(i) 'nom de la feuille
Sheets(feuil).Select
Progression = Progression + 1
On Error Resume Next 'Voici la modif... et ça fonctionne
image_barre.Width = Int((i / nbToGo) * 100) * 3.34
Label_barre.Caption = Int((i / nbToGo) * 100) & "%"
DoEvents
'On lance la conversion
ToPdf
End If
Next
Application.ScreenUpdating = True
To_PDF.Height = 249.75
End Sub
On Error Resume Nextest à éviter... sauf en cas d'absolu nécessité.. ce qui n'est pas le cas ici....
Private Sub Cmd_PDF_Click() Dim i As Byte Dim nbToGo As Integer Dim Progression As Integer ' Nombre d'elements dans la liste nbToGo = ListBox1.ListCount Dim prc As Integer Application.ScreenUpdating = False To_PDF.Height = 225.75 'boucle sur les éléments de la ListBox image_barre.Width = 1 Progression = 0 For i = 0 To nbToGo - 1 Progression = Progression + 1 prc = Int(Progression / nbToGo * 100) Debug.Print "Progression:" & Progression & " nbToGo:" & nbToGo & " prc = " & prc image_barre.Width = Int((Progression / nbToGo) * 100) * 3.34 Label_barre.Caption = Int((Progression / nbToGo) * 100) & "%" If ListBox1.Selected(i) = True Then feuil = ListBox1.List(i) 'nom de la feuille Sheets(feuil).Select DoEvents 'On lance la conversion ToPdf End If Next Application.ScreenUpdating = True To_PDF.Height = 249.75 End Sub