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 45 46 47 48 49
|
If test7 Then
longlist = ListX.ListCount
num = longlist - 1
While num >= 0
nomfichier = ListX.List(num, 0)
a = False
For i = 0 To ListX2.ListCount - 1
If ListX2.List(i, 0) = nomfichier Then a = True
Next i
If ListX.Selected(num) = True Then
If Not a Then
ChangeFileOpenDirectory (cheminX.Text)
Selection.InsertFile nomfichier, Range:="", _
ConfirmConversions:=False, Link:=True, Attachment:=False
End If
indice = Selection.PreviousField.Index
While InStr(1, ActiveDocument.Fields(indice).Code.Text, "INCLUDETEXT", 1) = 0
indice = Selection.PreviousField.Index
Wend
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End If
If a And ListX.Selected(num) = False Then
indice = Selection.PreviousField.Index
While InStr(1, ActiveDocument.Fields(indice).Code.Text, "INCLUDETEXT", 1) = 0
indice = Selection.PreviousField.Index
Wend
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End If
num = num - 1
DoEvents
Wend
a = False
For i = 0 To ListX2.ListCount - 1
If ListX2.List(i, 0) = "00-1.doc" Then a = True
Next i
If Not a Then
ChangeFileOpenDirectory (cheminXx.Text)
Selection.InsertFile FileName:="00-1.doc", Range:="", _
ConfirmConversions:=False, Link:=True, Attachment:=False
DoEvents
End If
indice = Selection.PreviousField.Index
While InStr(1, ActiveDocument.Fields(indice).Code.Text, "INCLUDETEXT", 1) = 0
indice = Selection.PreviousField.Index
Wend
Selection.MoveLeft Unit:=wdCharacter, Count:=1
DoEvents
End If |
Partager