|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 批量删除图片()
- '从后面往前删除
- '删除文档中所有长宽均小于2厘米的图片
- Dim n&
- On Error Resume Next
- With ActiveDocument
- MsgBox "嵌入式图片数量(比如:网络图片) = " & .InlineShapes.Count & Space(5) & vbCr & "图片数量(比如:绘图画出的图形) = " & .Shapes.Count, 0 + 48
- For n = .InlineShapes.Count To 1 Step -1 'InlineShapes类型图片(嵌入式)
- With .InlineShapes(n)
- If Round(.Height / 28.3, 2) <= 2 And Round(.Width / 28.3, 2) <= 2 Then .Delete
- End With
- Next
- For n = .Shapes.Count To 1 Step -1 'Shapes类型图片
- With .Shapes(n)
- If Round(.Height / 28.3, 2) <= 2 And Round(.Width / 28.3, 2) <= 2 Then .Delete
- End With
- Next
- MsgBox "处理完毕!" & vbCr & "嵌入式图片数量(比如:网络图片) = " & .InlineShapes.Count & Space(5) & vbCr & "图片数量(比如:绘图画出的图形) = " & .Shapes.Count, 0 + 48
- End With
- End Sub
复制代码 |
|