需要使用VBA在Microsoft Word中的图像下方插入文本

时间:2016-01-07 06:22:31

标签: vba ms-word word-vba

所以我在Microsoft Word中有很多图像,我需要在每个图像下方插入文字。我一直在使用:

Selection.InsertBefore Text="blah"

(以及其他代码) 但它在每个图像的左侧插入文本

我需要在

之下或之上插入文字

1 个答案:

答案 0 :(得分:-1)

Sub SomeSub()

    'After inserting the text above the image the text will be selected
    With Selection
        .MoveLeft
        .InsertBefore vbCr
        .InsertBefore "blah"
    End With

    'After inserting the text below the image the text and
    'the paragraph marker next to the image will be selected
    With Selection
        .MoveRight
        .InsertAfter vbCr
        .InsertAfter "blah"
    End With


End Sub