Compter uniquement les slides actives est-ce possible ?
Bonjour,
j'utilise dans une macro, "ActivePresentation.Slides.count" pour compter le nombre de slides et générer un pourcentage sur chaque slide, me permettant d'avoir l'avancement directement sur le PPT.
Or certaines de mes slides sont volontairement masquées, pour me permettre de cliquer dessus et donner un complément d'info si besoin.
Le seul problème c'est que les slides masquées me posent problème dans le calcul de l'avancement.
Y a-t-il moyen de savoir si une slide est masquée ou non ?
Merci
David
Mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| Option Explicit
Sub progBar()
Dim lngTotal As Long
Dim lngIndx As Long
Dim osld As Slide
Dim oshp1 As Shape
Dim oshp2 As Shape
Dim otB As Shape
Dim Pages_A_Exclure As Integer
On Error Resume Next
Pages_A_Exclure = CInt(InputBox("Souhaitez-vous exclure des pages en fin de présentation ?", "Nombre de pasge à exclure", "0"))
lngTotal = ActivePresentation.Slides.Count - Pages_A_Exclure
If lngTotal < 0 Then
lngTotal = 0
End If
For Each osld In ActivePresentation.Slides
osld.Shapes("Marker1").Delete
osld.Shapes("Marker2").Delete
osld.Shapes("Marker3").Delete
If lngIndx <= lngTotal - Pages_A_Exclure Then
lngIndx = osld.SlideIndex
If lngIndx > 1 Then
Set oshp1 = osld.Shapes.AddShape(msoShapePie, 30, ActivePresentation.PageSetup.SlideHeight - 21, 20, 20)
With oshp1 'vbgreen
'.Fill.Solid
.Fill.ForeColor.RGB = RGB(0, 211, 49)
.Fill.Transparency = 0.2
'.Fill.ForeColor.Brightness = 0
'.Fill.ForeColor.TintAndShade = 0
.Line.Visible = False
.Adjustments(1) = -90
.Adjustments(2) = -90
.Name = "Marker1"
End With
If osld.SlideIndex <> lngTotal Then
Set oshp2 = osld.Shapes.AddShape(msoShapePie, 30, ActivePresentation.PageSetup.SlideHeight - 21, 20, 20)
With oshp2 'vbred
.Fill.ForeColor.RGB = RGB(255, 0, 12)
.Fill.Transparency = 0.2
'.Fill.BackColor.RGB = RGB(255, 0, 12)
'.Fill.ForeColor.Brightness = 0
''.Fill.ForeColor.TintAndShade = 0
.Line.Visible = False
.Adjustments(1) = (360 * (lngIndx / lngTotal)) - 90
.Adjustments(2) = -90
.Name = "Marker2"
End With
End If
Set otB = osld.Shapes.AddLabel(msoTextOrientationHorizontal, 1, ActivePresentation.PageSetup.SlideHeight - 16, 40, 10)
otB.Line.Visible = msoFalse
With otB.TextFrame.TextRange
.Font.Size = 8
.Text = Round((lngIndx / lngTotal) * 100, 0) & "%"
End With
otB.Name = "Marker3"
End If
End If
Next osld
End Sub |