将图片插入Word文档时如何检索图像文件名

时间:2017-02-17 16:17:13

标签: vba ms-word

我有包含一些图片的Word文档。添加图片的代码是:
    ActiveDocument.Shapes.AddPicture Anchor:= Selection.Range, fileName:=localFileName, LinkToFile:=True, SaveWithDocument:=True

有没有回到那张图片并读取文件名变量?我可以浏览ActiveDocument的Shapes集合并检查图片,但是我没有看到会公开localFileName的属性。

1 个答案:

答案 0 :(得分:0)

对于使用

添加到Word文档的图像

ActiveDocument.Shapes.AddPicture Anchor:= Selection.Range, fileName:=localFileName, LinkToFile:=True, SaveWithDocument:=True

方法,该链接可用作

ShapeOfInterest.LinkFormat.SourceFullName 

仅当文档中有链接时才有效。通过在“信息”屏幕上查找“相关文档”下将出现“编辑文件链接”菜单项的文档,您将知道是否是这种情况。对于缺少链接(?)的情况,您将收到一个空图像和linked image cannot be displayed image

通常,即使您收到错误消息,该链接仍然可用。在我的文件中没有。

相关问题