vba help w Embedded object

L

Lance

Hey all,

Trying to write some code to edit embedded XL sheets in PPT 2007

VBA runs, opens up the first object, edits it,
then crashes with the following error:

OLEFormat (unknown member): Invalid request. The window must be in slide
or notes view

I am somewhat of a newbie and have no idea what this error means or how
to fix it. Any help would be appreciated.

Again, thanks in advance,

Lance









Sub RemoveTabs()

Dim oShape As Shape
Dim oSlide As Slide
Dim oGraph As Object

Application.DisplayAlerts = False
For Each oSlide In ActivePresentation.Slides
For Each oShape In oSlide.Shapes
If oShape.Type = 7 Then
oShape.OLEFormat.Activate
Set oChart = oShape.OLEFormat.Object
Sheetname = oChart.Activesheet.Name
For Each oSheet In oChart.worksheets
If oSheet.Name <> Sheetname Then
oSheet.Delete
End If
Next oSheet
End If
Next oShape
Next oSlide

End Sub
 
Top