Skip to main content

Word 如何将链接的图像转换为嵌入?

Updated Markdown
Part of seriesTechnology
Word 如何将链接的图像转换为嵌入?

如果是网页等形式,或者本身图片以引用的方式插入,则除了 docx 文档外还需要给出额外的图片文件,并保证路径可用,否则就会如下图所示:

1.png

这种情况下,我们可以使用VBA代码将链接的图像转换为嵌入式图像。

  1. 打开Word文档,同时保证链接图像可以正常显示。 按 Alt + F11 键打开 Microsoft Visual Basic应用程序 窗口。
  2. 插入模块,粘贴下方的 VBA 代码并执行。

2.png

Sub convert_all_inline_shapes()
    Dim xIShape As InlineShape
    For Each xIShape In ActiveDocument.InlineShapes
        With xIShape
            If .Type = wdInlineShapeLinkedPicture Then
                .LinkFormat.SavePictureWithDocument = True
                .LinkFormat.BreakLink
            End If
        End With
    Next
End Sub

About the author

No comments yet. Be the first to comment.

More from this blog