Quote:
Originally Posted by Guessed
You probably missed the last line of code when you pasted it into VBA
It should end with a line that says
End Sub
|
I did end the "End Sub" part. I have removed that error, but the code still isn't working. This is why I am doing.
Going to the View tab in Word. Clicking on Macros -> View Macros -> Create
Then I get a screen that says:
Sub Macro1()
'
' Macro1 Macro
'
'
End Sub
I am deleting all of that and pasting in:
Sub Macro1()
Dim oShape As Shape
Dim i As Integer
For i = ActiveDocument.Shapes.Count To 1 Step -1
Set oShape = ActiveDocument.Shapes(i)
If oShape.Type = msoPicture Then oShape.Delete
Next i
Set oShape = nothing
End Sub
I change the name to ImageRemover and get the below code:
Sub Macro1()
Dim oShape As Shape
Dim i As Integer
For i = ActiveDocument.Shapes.Count To 1 Step -1
Set oShape = ActiveDocument.Shapes(i)
If oShape.Type = msoPicture Then oShape.Delete
Next i
Set oShape = Nothing
End Sub
Sub ImageRemover()
End Sub
I then hit F5 -> Run
Lo and behold, the images still remain in the document.
I have already removed a fair number of images, by using ^g and replacing it with nothing. There are still heaps of other images though in my 9000 page document that remain.