View Single Post
 
Old 02-27-2024, 08:14 AM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Windows 11 Office 2021
Moderator
 
Join Date: Aug 2011
Posts: 4,036
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

At least in theory, you should be able to delete InlineShapes with a very similar macro:

Sub Macro1()
Dim oShape As InlineShape
Dim i As Integer
For i = ActiveDocument.InlineShapes.Count To 1 Step -1
Set oShape = ActiveDocument.InlineShapes(i)
If oShape.Type = msoPicture Then
oShape.Delete
Else
Debug.Print oShape.Type
End If
Next i
Set oShape = Nothing
End Sub

EDIT: The above code only acts on shape objects that are pictures. That is what the msoPicture is referring to. I initially overlooked this when I tried to customize the original macro.


However, I am not sure that I remember correctly which objects are recognized as inline shapes, anymore. :-(

Are you able to share a sample document with the forum? I am not referring to the entire 3000 page document, obviously, but a much shorter version with just the shapes/graphics and some dummy text.
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional

Last edited by Stefan Blom; 03-01-2024 at 07:27 AM.
Reply With Quote