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
| Dim oTarDoc As Document, oSourceDoc As Document
Dim CheminCommonInformations As String
Dim CheminRegulation As String
Dim oRng As Word.Range
Private Sub GenerateButton1_Click()
ActiveDocument.Paragraphs.LineSpacingRule = wdLineSpaceSingle
Set oTarDoc = ActiveDocument
If CommonInformations.Value = True Then
CheminCommonInformations = "C:\...\Common Informations.docx"
Set oSourceDoc = Documents.Open(CheminCommonInformations)
With oTarDoc
'se positionne au bookmark CommonInformation dans le template
Set oRng = .Bookmarks("CommonInformations").Range
'Récupère le texte du bookmark All du fichier source
oRng.text = oSourceDoc.Bookmarks("All").Range.text
'Ajoute le texte au bookmark du document actif
.Bookmarks.Add "CommonInformations", oRng
End With
oSourceDoc.Close
End If |
Partager