在图像之前插入分段符

时间:2015-02-24 22:27:12

标签: image vba ms-word word-vba

如何创建宏以在文件中的每个图像之前插入分段符?

1 个答案:

答案 0 :(得分:0)

如果您的图片属于InlineShapes类型,则下面的代码可以解决问题:

Sub InsertParagraphBeforeInlinShapes()

    Dim iSHP As InlineShape
    For Each iSHP In ActiveDocument.InlineShapes

        ActiveDocument.Range(iSHP.Range.Start, _
                                iSHP.Range.Start).InsertParagraphBefore

    Next iSHP

End Sub