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
| Sub word()
Dim WordApp As Object, WordDoc As Object, ctrl As Object
Dim nom_fichier As String
Set WordApp = CreateObject("word.application")
WordApp.Visible = True
nom_fichier = "C:\Users\*********\Desktop\Divers\test.docx"
Set WordDoc = WordApp.Documents.Open(nom_fichier)
For K = 1 To 3
ActiveSheet.ChartObjects("Graphique " & K).Activate
ActiveChart.ChartArea.Copy
WordDoc.bookmarks("Graph" & K).Range.Select
WordApp.Selection.PasteandFormat (wdchartPicture)
WordApp.Selection.ParagraphFormat.Alignment = 1 'wdAlignParagraphCenter
Next
With WordApp.Selection
Sheets("Feuil1").Range("A1:G7").Copy
WordDoc.bookmarks("Zone1").Range.Select
WordApp.Selection.PasteSpecial DataType:=wdPasteEnhancedMetafile, Placement:=1
End With
End Sub |
Partager