Search code examples
powerpoint

Powepoint: How to tweak progress bar so it is 100% on my "Thank you!" slide and not my extra slides?


I added a progress bar to my slides with the following code in macros:

Sub ProgressBar()
On Error Resume Next
With ActivePresentation
For X = 1 To .Slides.Count
.Slides(X).Shapes("PB").Delete
Set s = .Slides(X).Shapes.AddShape(msoShapeRectangle, _
0, .PageSetup.SlideHeight - 12, _
X * .PageSetup.SlideWidth / .Slides.Count, 12)
s.Fill.ForeColor.RGB = RGB(42, 0, 128)
s.Name = "PB"
Next X:
End With
End Sub

I do not want the progress bar to be 100% at the end of my slides (at my extra slides), but at my "Thank you" slide. Is there a way to do this?


Solution

  • Change this:

    For X = 1 To .Slides.Count
    

    to this

    For X = 1 To .Slides(42)
    

    But instead of 42, use the number of your thank you slide