Remove Web stuff

D

Dennis Saunders

I've a macro that used to remove extra-aneous rubbish from copy and pasted
web pages, but now there are more objects which remain. These are embedded
forms and pictures.
I don't know how I should refer to them to delete them.

Sub DelWebstuff()
'
' Macro2 Macro
'

'
On Error Resume Next
ActiveSheet.Hyperlinks.Delete
ActiveSheet.OLEObjects.Delete
ActiveSheet.DrawingObjects.Delete
ActiveSheet.Shapes.SelectAll
Selection.Delete
On Error GoTo 0
End Sub

Any ideas please?
 
R

Ron de Bruin

If you use this one Dennis is it OK then ?

Sub Shapes1()
'Delete all Objects except Comments
On Error Resume Next
ActiveSheet.DrawingObjects.Visible = True
ActiveSheet.DrawingObjects.Delete
On Error GoTo 0
End Sub
 
B

Brian Cryer

Dennis Saunders said:
I've a macro that used to remove extra-aneous rubbish from copy and pasted
web pages, but now there are more objects which remain. These are embedded
forms and pictures.

I know that Ron has already given you the answer to this question, but you
might find that changing the way you do a copy and paste will remove the
need for the macro. Try pasting into notepad and then copy from notepad
before pasting into Excel. That will get rid of everything except the plain
text.
 
D

Dennis Saunders

Thanks Ron,
it looks like the visible line did the trick.
They were visible to me! but not to Excel!
Your help is gratefully appreciated.
Also thanks for your reply Brian.
Regards Dennis
 
D

Dennis Saunders

I agree Brian,
but it can be over 1600 lines and then it would be a nightmare to parse it
properly.
Ron figured out the problem....just make the drawing objects visible.
Thanks for your suggestion though.

My sub macro now looks like:

Sub DelWebstuff()
'
' Macro2 Macro
' Macro recorded 22/02/2003 by Dennis
'

'
On Error Resume Next
ActiveSheet.Hyperlinks.Delete
ActiveSheet.OLEObjects.Delete
ActiveSheet.DrawingObjects.Visible = True
ActiveSheet.DrawingObjects.Delete
On Error GoTo 0

End Sub

Regards Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top