【问题标题】:How can I add a paragraph between images?如何在图像之间添加段落?
【发布时间】:2013-03-08 10:29:09
【问题描述】:

我一直在向 Word 中的 customUi 菜单中添加一系列按钮。其中一个按钮从服务器上的库文件夹中导入一个或多个图像,但是当它添加到页面时,我无法让它在每个图像之间放置一个段落返回。

With fd
    .InitialFileName = strFolder & "\*.png; *.jpg; *.gif"
    .ButtonName = "Insert"
    .AllowMultiSelect = True  ' Make multiple selection
    .Title = "Choose one or more pictures from the library"
    .InitialView = msoFileDialogViewPreview

'Sets the initial file filter to number 2.
'    .FilterIndex = 2

'Use the Show method to display the File Picker dialog box and return the user's action.
'If the user presses the action button...
If .Show = -1 Then
'Step through each string in the FileDialogSelectedItems collection.
    For Each vrtSelectedItem In .SelectedItems
'vrtSelectedItem is a String that contains the path of each selected item.
    Selection.InlineShapes.AddPicture FileName:= _
                  vrtSelectedItem _
                , LinkToFile:=False, SaveWithDocument:=True

    Next vrtSelectedItem

我尝试在不同的地方添加段落行 [Selection.TypeParagraph],但它只是在所有图像之后添加了返回。 任何帮助将不胜感激。

【问题讨论】:

    标签: vba import openfiledialog


    【解决方案1】:

    您是否尝试使用:

    Selection.InsertParagraphAfter
    Selection.Move
    

    这可能是您正在寻找的? 在Next 语句之前添加一行。

    【讨论】:

    • 感谢您的建议。我发现我需要它去的地方是在“For Each”阶段之后。我会试试你的建议。
    • 好的,我更改了答案并添加了Selection.Move,现在我想这对你来说没问题。请确认...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-15
    • 1970-01-01
    • 2013-10-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多