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 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Option Explicit
Public ContenuSignet1 As String, ContenuSignet2 As String, ContenuSignet3 As String
Public Continuer As Boolean
Sub MettreAJourLesSignets()
Continuer = False
With UsfSignets
.TextBoxSignet1 = ActiveDocument.Bookmarks("Texte1").Range.Text
.TextBoxSignet2 = ActiveDocument.Bookmarks("Texte2").Range.Text
.TextBoxSignet3 = ActiveDocument.Bookmarks("Texte3").Range.Text
.Show
End With
If Continuer = False Then Exit Sub
MajSignet ActiveDocument, "Texte1", ContenuSignet1
MajSignet ActiveDocument, "Texte2", ContenuSignet2
MajSignet ActiveDocument, "Texte3", ContenuSignet3
MettreAJourLesRenvois
End Sub
Sub MajSignet(ByVal DocEnCours As Document, ByVal NomDuSignet As String, ByVal ContenuDuSignet As String)
DocEnCours.Bookmarks(NomDuSignet).Select
With Selection
.Range.Text = ContenuDuSignet
.Expand Unit:=wdParagraph
.Bookmarks.Add Name:=NomDuSignet
.MoveRight Unit:=16
.TypeParagraph
End With
End Sub
Sub MettreAJourLesRenvois()
Dim WdDoC As Document
Dim I As Integer
Set WdDoC = ActiveDocument
With WdDoC
.Range.Fields.Update ' Renvoi Textes 2 et 3
For I = 1 To .Shapes.Count
With .Shapes(I).TextFrame
If .HasText Then
If .TextRange.Fields.Count > 0 Then .TextRange.Fields.Update ' Renvoi Texte1
End If
End With
Next I
End With
Set WdDoC = Nothing
End Sub |
Partager