Hi There,
I have created a code that will delete objects from a PPTX in 2007 however there are a couple of objects I don't want to delete. To test this, I need to use the "msgbox" function to show me what object I am selecting - I am using the code below. Can someone tell me what I am doing wrong for the msgbox not to appear and tell me the object type i have selected?
Thanks!!
Public pptApp As Object
Sub Start_PPT()
Set pptApp = CreateObject("powerpoint.application")
End Sub
Sub Delete()
Dim i, j, iShapeCount As Integer
Start_PPT
With pptApp
.Visible = True
For i = 4 To .ActivePresentation.Slides.Count
.ActivePresentation.Slides(i).Select
iShapeCount = .ActiveWindow.Selection.SlideRange.Shapes.Count
For j = iShapeCount To 1 Step -1
'For j = 1 To ActiveWindow.Selection.SlideRange.Shapes.Count
'Do While i <> 200
' On Error Resume Next
ActiveWindow.Selection.SlideRange.Shapes(i).select
Msgbox ActiveWindow.Selection.SlideRange.Shapes(j).Type <--- here is the error
' If .ActiveWindow.Selection.SlideRange.Shapes(j).Type = 13
' .ActiveWindow.Selection.SlideRange.Shapes(j).Select
'ActiveWindow.Selection.SlideRange.Shapes(j).Delete
'i = i + 1
End If
'Loop
Next j
Next i
End With
makePowerPoint
End Sub
I have created a code that will delete objects from a PPTX in 2007 however there are a couple of objects I don't want to delete. To test this, I need to use the "msgbox" function to show me what object I am selecting - I am using the code below. Can someone tell me what I am doing wrong for the msgbox not to appear and tell me the object type i have selected?
Thanks!!
Public pptApp As Object
Sub Start_PPT()
Set pptApp = CreateObject("powerpoint.application")
End Sub
Sub Delete()
Dim i, j, iShapeCount As Integer
Start_PPT
With pptApp
.Visible = True
For i = 4 To .ActivePresentation.Slides.Count
.ActivePresentation.Slides(i).Select
iShapeCount = .ActiveWindow.Selection.SlideRange.Shapes.Count
For j = iShapeCount To 1 Step -1
'For j = 1 To ActiveWindow.Selection.SlideRange.Shapes.Count
'Do While i <> 200
' On Error Resume Next
ActiveWindow.Selection.SlideRange.Shapes(i).select
Msgbox ActiveWindow.Selection.SlideRange.Shapes(j).Type <--- here is the error
' If .ActiveWindow.Selection.SlideRange.Shapes(j).Type = 13
' .ActiveWindow.Selection.SlideRange.Shapes(j).Select
'ActiveWindow.Selection.SlideRange.Shapes(j).Delete
'i = i + 1
End If
'Loop
Next j
Next i
End With
makePowerPoint
End Sub