第一步:打开视图-宏
第二步:输入宏名(可以是人以文字、字母或数字加字母,但不能是纯数字)
第三步:点击创建
第四步:复制以下文字
Sub Test()Dim oSlide As Slide, oShape As ShapeDim myWidth As Single, myHeight As Single, myTop As Single, myLeft As SingleOn Error Resume NextIf ActiveWindow.Selection.ShapeRange.Count <> 1 ThenIf Err.Number <> 0 ThenMsgBox "none" & vbCrLf & "choose one", vbExclamation + vbOKOnlyErr.ClearExit SubEnd IfMsgBox "choose exceed 1" & vbCrLf & "choose one", vbExclamation + vbOKOnlyExit SubEnd IfSet oShape = ActiveWindow.Selection.ShapeRange(1)myTop = oShape.TopmyLeft = oShape.LeftmyHeight = oShape.HeightmyWidth = oShape.WidthFor Each oSlide In ActivePresentation.SlidesFor Each oShape In oSlide.ShapesIf Abs(myTop - oShape.Top) < 1 And Abs(myLeft - oShape.Left) < 1 And Abs(myHeight - oShape.Height) < 1 And Abs(myWidth - oShape.Width) < 1 ThenoShape.DeleteEnd IfNextNextEnd Sub
第五步:删除原来的“宏代码”
第六步:将复制的文字粘贴到打开的“宏代码”空白处
第七步:关闭或最小化“宏代码”文档
第八步:在原文档中点击选中要删除的图片或其他对象
第九步:点击宏-运行
至此,所有相同位置的文搞对象都已经删除,点击“保存”就可以了
来源地址:https://blog.csdn.net/xueyizhiyong_/article/details/127958934