View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.links,microsoft.public.excel.misc,microsoft.public.excel.worksheet.functions
come_mon_come_mon! come_mon_come_mon! is offline
external usenet poster
 
Posts: 21
Default How to get rid of web page objects ?


zz ¼g¹D¡G

this is an improved version of the previous code, now it "cleans" the sheet
of anything but text.


Private Sub deleteobjects()
Dim s As Worksheet, chrt As ChartObject, shp As Shape
Set s = ActiveSheet
Dim olObj As OLEObject
With s
For Each shp In .Shapes
.Shapes(.Shapes.Count).Delete
Next
For Each chrt In ChartObjects
.ChartObjects(.ChartObjects.Count).Delete
Next
For Each olObj In .OLEObjects
.OLEObjects(.OLEObjects.Count).Delete
Next
End With
Set s = Nothing
Set olObj = Nothing
Set chrt = Nothing
Set shp = Nothing
End Sub



I put the above code into Excel macro sub. It ran and deleted objects
but it also returned error "424 object needed here".

Debugger pointed at the line "For Each olObj In .OLEObjects"