面朝大海,春暖花开

作者:xiaokcehui2023-12-27 6:56分类: others 标签: word

Word的宏功能默认是禁止的,需要开启,否则,代码无法粘贴到模块中。

粘贴如下代码至Word的VBA模块中,执行程序

Sub RemoveAllHyperlinksFromPicturesInOneDocument()
Dim objInlinePicture As InlineShape
Dim objPicture As Shape
if ActiveDocument.InlineShapes.Count > 0 Then
For Each objInlinePicture In ActiveDocument.InlineShapes
objInlinePicture.Select
While Selection.Hyperlinks.Count > 0
Selection.Hyperlinks(1).Delete
Wend
Next
End If
If ActiveDocument.Shapes.Count > 0 Then
For each objPicture In ActiveDocument.Shapes
objPicture.Select
While Selection.Hyperlinks.Count > 0
Selection.Hyperlinks(1).Delete
Wend
Next
End If

Msgbox “成功”
End Sub

温馨提示如有转载或引用以上内容之必要,敬请将本文链接作为出处标注,谢谢合作!

已有 0/564 人参与

发表评论:

欢迎使用手机扫描访问本站,还可以关注微信哦~