Private Sub Génération_Click()
'Déclaration variables
Dim WordApp As Object
Dim WordDoc As Object
Dim DocumentWord As String
DocumentWord = Worksheets("Sheet1").Cells(15, 4).Value
Set WordApp = CreateObject("word.application") 'ouvre Word
Set WordDoc = WordApp.Documents.Open(DocumentWord) 'ouvre DOC D15
WordApp.Visible = False 'word masqué
'Premier Paragraphe
If CheckBox2.Value = True Then
WordDoc.Paragraphs.Add
WordDoc.Range.Text = Worksheets("Paragraphe1").Range("B2") 'Copie du texte
msgbox ("Paragraphe 1 Added") 'Annonce l'ajout du paragraphe
ElseIf CheckBox2.Value = False Then
WordDoc.Range.Text = Worksheets("Paragraphe1").Range("B6") 'Copie du texte
End If
'Deuxième Paragraphe
If CheckBox1.Value = True Then
WordDoc.Paragraphs.Add
WordDoc.Range.Text = Worksheets("Paragraphe2").Range("B2") 'Copie du texte
msgbox ("Paragraphe Avec Chauffage Added") 'Annonce l'ajout du paragraphe
ElseIf CheckBox1.Value = False Then
WordDoc.Paragraphs.Add
WordDoc.Range.Text = Worksheets("Paragraphe2").Range("B6") 'Copie du texte
msgbox ("Paragraphe Sans chauffage Added") 'Annonce l'ajout du paragraphe
End If
WordApp.Visible = True
End Sub