Skip to content

Instantly share code, notes, and snippets.

@nmeylan
Last active August 29, 2015 14:08
Show Gist options
  • Save nmeylan/efb1acd58a9e088483cb to your computer and use it in GitHub Desktop.
Save nmeylan/efb1acd58a9e088483cb to your computer and use it in GitHub Desktop.
MS office progess bar
Sub AddProgressBar()
On Error Resume Next
With ActivePresentation
sHeight = .PageSetup.SlideHeight - 60
sImage1Path = ActivePresentation.Path + "\Image1.png"
sImage2Path = ActivePresentation.Path + "\Image2.png"
sImage3Path = ActivePresentation.Path + "\Image3.png"
n = 0
j = 0
For i = 1 To .Slides.Count
If .Slides(i).SlideShowTransition.Hidden Then j = j + 1
Next i:
For i = 2 To .Slides.Count
.Slides(i).Shapes("progressBar").Delete
.Slides(i).Shapes("turtle").Delete
.Slides(i).Shapes("target").Delete
If .Slides(i).SlideShowTransition.Hidden = msoFalse Then
Set target = .Slides(i).Shapes.AddPicture(sImage3Path, msoFalse, msoTrue, .PageSetup.SlideWidth - 40, .PageSetup.SlideHeight - 40, 40, 40)
Set slider = .Slides(i).Shapes.AddPicture(sImage1Path, msoFalse, msoTrue, ((i - n) * .PageSetup.SlideWidth / (.Slides.Count - j)) - 50, sHeight, 50, 60)
Set turtle = .Slides(i).Shapes.AddPicture(sImage2Path, msoFalse, msoTrue, (((i - n) * (.PageSetup.SlideWidth / 3) / (.Slides.Count - j) + (.PageSetup.SlideWidth / 3))), sHeight, 50, 50)
With slider
.Name = "progressBar"
End With
With turtle
.Name = "turtle"
End With
With target
.Name = "target"
End With
Else
n = n + 1
End If
Next i:
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment