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
发表评论: