1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
Sub essai_w()
Dim T_fic() As String
ChDir "D:\PatrickBrunel\IVQ\etudes\Qualif\Generation\Fiches essais\DO160\DO160_E"
myName = Dir("*.doc")
While myName <> ""
i = i + 1
ReDim Preserve T_fic(1 To i)
T_fic(i) = myName
myName = Dir()
Wend
Set cible = ActiveDocument
n_para = cible.Paragraphs.Count
For i_para = 1 To n_para
le_texte = cible.Paragraphs(i_para).Range.Text
If le_texte = "Debut" & Chr(13) Then
For i = 1 To UBound(T_fic)
pos_ec = i_para + 2
Set poi = cible.Paragraphs(pos_ec).Range
poi.Select
With poi
.Collapse Direction:=wdCollapseEnd
.InsertFile FileName:=T_fic(i), ConfirmConversions:=False
.MoveEnd unit:=wdCharacter, Count:=1
.InsertParagraphAfter
.InsertBreak Type:=wdSectionBreakNextPage
.Collapse Direction:=wdCollapseEnd
End With
Next i
End If
Next i_para
End Sub |
Partager