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
|
cheminfichier = Sheets("Données").Range("d3").Value
nomfichier = Sheets("Données").Range("d2").Value & ".doc"
Set word_app = CreateObject("Word.Application")
With word_app
.Visible = False
.WindowState = wdWindowStateMaximize
End With
Sheets("Feuil1").Shapes.Range(Array("copies")).Select
Selection.Verb Verb:=xlOpen
For i = 1 To 19
word_app.Selection.Find.ClearFormatting
word_app.Selection.Find.Replacement.ClearFormatting
With word_app.Selection.Find
.Text = Sheets("Données").Cells(i, 1).Value
.Replacement.Text = Sheets("Données").Cells(i, 2).Value
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
word_app.Selection.Find.Execute Replace:=2
Next
word_app.ActiveDocument.SaveAs Filename:=cheminfichier & nomfichier
word_app.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges |
Partager