【问题标题】:Need to insert text below images in microsoft word with VBA需要使用 VBA 在 microsoft word 中的图像下方插入文本
【发布时间】:2016-01-07 18:09:40
【问题描述】:

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

Selection.InsertBefore Text="blah"

(连同其他代码) 但它会在每张图片的左侧插入文本

我需要在下方或上方插入文本

【问题讨论】:

  • 在 blah 中添加换行符,可能类似于 Selection.InsertBefore Text="blah" & vbNewLine ... 只是猜测。
  • 内嵌图像、浮动图像还是两者兼有?
  • 这些图像是一个在另一个之下,还是一些彼此相邻?如果彼此相邻,你用什么来定位它们?

标签: vba ms-word


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 1970-01-01
    • 2015-01-19
    相关资源
    最近更新 更多