[COLOR=black][FONT=Verdana]Sub Traitement()[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]Dim v[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Selection.EndKey Unit:=wdStory[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]On Error GoTo Fin[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]For I = LBound(ATraiter) To UBound(ATraiter)[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]On Error GoTo 0[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]With Selection[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .InsertBreak Type:=wdPageBreak[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TypeText Text:=ATraiter(I) & " : " & DateModif(I)[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Style = ActiveDocument.Styles("Cathy")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TypeParagraph[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Style = ActiveDocument.Styles("Normal")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]ChangeFileOpenDirectory Chemin[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Documents.Open filename:=ATraiter(I), _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] PasswordDocument:="", PasswordTemplate:="", Revert:=False, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] wdOpenFormatAuto, XMLTransform:=""[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]v = Split(ActiveDocument.Path, "\")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]sem = IIf(UBound(v) > 0, v(UBound(v) - 1), v(UBound(v)))[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]'MsgBox sem[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Selection.WholeStory 'tout sélectionner[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Selection.Copy[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]ActiveWindow.Close[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Selection.EndKey Unit:=wdStory 'fin du doc[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .PasteAndFormat (wdPasteDefault)[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]End With[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Next I[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]'mise en forme****[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]'polices[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Selection.HomeKey Unit:=wdStory 'début du doc[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]With Selection[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Style = ActiveDocument.Styles("Titre 1")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]WordBasic.SelectSimilarFormatting[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Style = ActiveDocument.Styles("Style")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .WholeStory[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .MoveUp Unit:=wdLine, Count:=1[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]End With[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]With ActiveDocument[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] On Error Resume Next[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents(1).Delete[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] On Error GoTo 0[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] True, UseHeadingStyles:=False, LowerHeadingLevel:=1, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] UpperHeadingLevel:=1, IncludePageNumbers:=True, AddedStyles _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] :="Cathy;1", UseHyperlinks:=True, HidePageNumbersInWeb:=True, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] UseOutlineLevels:=True[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents(1).TabLeader = wdTabLeaderDots[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents.Format = wdIndexIndent[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]End With[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Erase ATraiter[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Erase DateModif[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Exit Sub[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Fin:[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]End Sub[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]Sub TDM() 'Table des matières[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]' ici transformation des styles en Titre1 et 2 pour créer le sommaire[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]For Each Paragraphe In ActiveDocument.Paragraphs[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]If Paragraphe.Style = "sous thème" Then Paragraphe.Style = "Titre1"[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]If Paragraphe.Style = "Thématique" Then Paragraphe.Style = "Titre2"[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Selection.HomeKey Unit:=wdStory[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]Selection.Collapse 'réduit la sélection au point d'insertion[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdMove[/COLOR][/FONT]
[COLOR=black][FONT=Verdana] Selection.Find.ClearFormatting[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] With Selection.Find[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Text = "Prompteur N°483 – "[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Replacement.Text = ""[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Forward = True[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Wrap = wdFindContinue[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .Format = False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .MatchCase = False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .MatchWholeWord = False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .MatchWildcards = False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .MatchSoundsLike = False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .MatchAllWordForms = False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End With[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Selection.Find.Execute[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] With ActiveDocument[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents(1).Delete[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] True, UseHeadingStyles:=True, UpperHeadingLevel:=2, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] LowerHeadingLevel:=2, IncludePageNumbers:=True, AddedStyles:= _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] "Titre 1;1;Thématique;2;sous thème;1;Titre;1", UseHyperlinks:=True, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] HidePageNumbersInWeb:=True, UseOutlineLevels:=False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents(1).TabLeader = wdTabLeaderDots[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] .TablesOfContents.Format = wdIndexIndent[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End With[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]End Sub[/COLOR][/FONT]