2024-04-27 07:22:05
2024-04-27 09:07:04
咋搞,能写个代码吗
Sub DeleteUrls()
Set Rex = CreateObject("VBSCRIPT.REGEXP")
With Rex
.Global = True
.IgnoreCase = True
.Pattern = "([a-zA-z]+://[^\s \,,;;]*)|([a-zA-Z0-9]+?\.[a-zA-Z0-9]+?\.[a-zA-Z0-9]+?[^ \s\,,;;]+)" '网址正则表达式
End With
For pi = 1 To ActivePresentation.Slides.Count
ActivePresentation.Slides(pi).Select
For Each Obj In ActivePresentation.Slides(pi).Shapes
Txt = Obj.TextFrame.TextRange.Text
bTest = Rex.Test(Txt)
If bTest Then
Obj.TextFrame.TextRange.Text = Rex.Replace(Txt, "")
End If
Next
Next
ActivePresentation.Save
MsgBox "本PPT文档中的所有网址被删除完毕!", vbInformation + vbOKOnly, "消息"
End Sub
打开你的一个PPT文档,然后按Alt+F11打开宏代码编辑器,将上述代码粘贴进去,然后按F5运行即可。如果是批量处理很多文档,推荐使用现成的上述工具软件。
2024-04-27 19:38:19