批量删除Word图片超链接的宏命令

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

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

批量删除Word图片超链接的宏命令

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

以上内容转载自:xiaok海洋测绘网
分享到:

原文链接:,转发请注明来源!
「批量删除Word图片超链接的宏命令」评论列表

发表评论