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
| Sub TestMajContentControl()
Dim I As Long, derLigne As Long
' derLigne=...
' For I = 2 To derLigne
MajContentControl WordDoc, ws.Cells(I, 1).Value, ws.Cells(I, 2).Value
' Next I
End Sub
Sub MajContentControl(ByVal WordDoc2 As Document, ByVal TitreDuControle As String, ByVal ContenuContentControl As Variant)
Dim J As Integer
With WordDoc2
For J = 1 To .ContentControls.Count
With .ContentControls(J)
If .Title = TitreDuControle Then
.Range.Text = ContenuContentControl
End If
End With
Next J
End With
End Sub |
Partager