通过VBA更新WORD 2016中的图片的多个源链接

时间:2018-05-03 09:30:11

标签: ms-word

我使用了一些VBA代码来更改所有图像的所有源位置。但是它只检测到3个InlineShapes。还有更多。我将所有图像插入为Insert和LInk

Sub ChangesSource()
Dim i As Long
Documents("Document.docx").Activate
Debug.Print ActiveDocument.Name

With ActiveDocument

For i = 1 To .InlineShapes.Count
With .InlineShapes(i)
'.shp.LinkFormat.SourceFullName =


.LinkFormat.SourceFullName = Replace(.LinkFormat.SourceFullName, "C:\oldLink", "C:\newLink")

Debug.Print .LinkFormat.SourceFullName
'Debug.Print InlineShapes(i).SourceFullName
End With
Next i
End With
End Sub

2 个答案:

答案 0 :(得分:0)

如果以较旧的.doc格式保存文档,按Alt-F9将显示包含链接的INCLUDEPICTURE字段。然后,您可以使用“查找/替换”来更新路径(请注意路径分隔符使用\\)。按Alt-F9,然后按Ctrl-Shift-F9将刷新链接的图像。如果愿意,您可以以docx格式重新保存文档。另一种选择是使用宏。

答案 1 :(得分:0)

尝试:

typings
相关问题