Chris Macro
Well-known Member
- Joined
- Nov 2, 2011
- Messages
- 1,345
- Office Version
- 365
- Platform
- Windows
Hopefully this is something that is an easy fix that I am overlooking. I am wanting to loop through each slide and essentially skip slides that do not contain a shape called Graph2 or Graph3. My error handler works fine in skipping the Title Slide however the second time around I need to handle an error, I actually get an error message popping up. I believe I am not resetting my error handler properly. Any thoughts?
Code:
Sub ErrorHandlingProblem()
Dim sld As Slide
Dim shpSelected As Shape
Dim shpTrigger As Shape
For Each sld In ActivePresentation.Slides
On Error GoTo SkipSlide
Set shpSelected = sld.Shapes("Graph3")
Set shpTrigger = sld.Shapes("Graph2")
On Error GoTo 0
'[Do Something...]
SkipSlide:
Err.Number = 0
Next sld
End Sub