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
| For i = 10 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Sheets(i).Select
If ThisWorkbook.Sheets(i).Range("A4").Value <> " " Then
sNomRapport = ThisWorkbook.Sheets(i).Range("A1") & "_" & ThisWorkbook.Sheets(i).Name
ThisWorkbook.Sheets(i).Range("Intro_" & i).Copy 'copie le tableau d'intro de chaque onglet
Set wrdApp = CreateObject("Word.Application") 'ouvre une session Word
wrdApp.Visible = False
Set wrdDoc = wrdApp.Documents.Add 'crée un nouveau document
wrdApp.Selection.Paste
ThisWorkbook.Sheets(i).Range("Recap_" & i).Copy 'copie le tableau de chaque onglet
wrdDoc.Paragraphs.Add 'ajoute un paragraphe de type ligne blanche
wrdDoc.Paragraphs(wrdDoc.Paragraphs.Count).Range.Paste 'colle après le paragraphe
ThisWorkbook.Sheets(i).Range("Graphs_" & i).CopyPicture 'copie en image les graphiques de chaque onglet
wrdDoc.Paragraphs.Add 'ajoute un paragraphe de type ligne blanche
wrdDoc.Paragraphs(wrdDoc.Paragraphs.Count).Range.PasteAndFormat (wdChartPicture) 'colle en image les graphiques après le paragraphe
ThisWorkbook.Sheets(i).Range("NC_" & i).Copy 'copie l'encadré NC
wrdDoc.Paragraphs.Add 'on ajoute un paragraphe
wrdDoc.Paragraphs(wrdDoc.Paragraphs.Count).Range.Paste 'on le colle après le paragraphe
ThisWorkbook.Sheets(i).Range("Conclusion_" & i).Copy 'copie l'encadré des commentaires
wrdDoc.Paragraphs.Add 'ajoute un paragraphe (une ligne blanche)
wrdDoc.Paragraphs(wrdDoc.Paragraphs.Count).Range.Paste 'colle après le paragraphe |