2013-03-08 82 views
0

我一直在向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],但它只是在所有圖像之後添加了返回值。 任何幫助,將不勝感激。

回答

0

你嘗試使用:

Selection.InsertParagraphAfter 
Selection.Move 

這可能是你在找什麼? 在Next聲明前添加行。

+0

感謝您的建議。我計算出我需要的地方是在'For Each'階段之後。我會試着用你的建議。 – Boyplunder 2013-03-08 10:46:44

+0

好吧,我改變了答案,我添加了'Selection.Move',現在我想對你來說可以。請確認... – 2013-03-08 11:01:35