由于要批量换ppt的图片,每次删除都头疼,于是在网上找方法,所谓的批量处理软件就是垃圾,根本没有卵用,去某宝找人处理,收费260??有这功夫我自己手动删除不就好了。于是继续在网上找方法,终于找到了用宏批量删除的方法。
第一步,首先安装wps宏插件Visual Basic for Application(点击链接下载),百度下,网上都有哈。如果开着wps请安装后关闭重启软件,否者就是js宏无法运行。如果还是js环境点击切换成vb,开发工具——切换环境。
第二步,点击-开发者工具-宏-输入名称-创建
第三步,复制代码到编辑栏
代码:
Sub 去掉图片()
Dim oSlide As Slide, oShape As Shape
Dim myWidth As Single, myHeight As Single, myTop As Single, myLeft As Single
On Error Resume Next
If ActiveWindow.Selection.ShapeRange.Count <> 1 Then
If Err.Number <> 0 Then
MsgBox "none" & vbCrLf & "choose one", vbExclamation + vbOKOnly
Err.Clear
Exit Sub
End If
MsgBox "choose exceed 1" & vbCrLf & "choose one", vbExclamation + vbOKOnly
Exit Sub
End If
Set oShape = ActiveWindow.Selection.ShapeRange(1)
myTop = oShape.Top
myLeft = oShape.Left
myHeight = oShape.Height
myWidth = oShape.Width
For Each oSlide In ActivePresentation.Slides
For Each oShape In oSlide.Shapes
If Abs(myTop - oShape.Top) < 1 And Abs(myLeft - oShape.Left) < 1 And Abs(myHeight - oShape.Height) < 1 And Abs(myWidth - oShape.Width) < 1 Then
oShape.Delete
End If
Next
Next
End Sub
第四步,关闭编辑框回到ppt,打开宏,点击运行。
注意:如果出现该工程禁止使用宏,那就把安全性调低,然后关闭ppt再重新打开运行宏即可。
完毕。