Bon, j'ai cherché pas mal sur internet et j'ai fini par trouver ça :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Dim objWord As New Word.Application
Dim MyRange As Range
Dim rtffile As Word.Document
Dim qDoc As Word.Document
Set rtffile = objWord.Documents.Open(FileName:="C:\Users\stagebe1\Desktop\2015 BTS1 Thomas Macro Word\InfosContrats.docx", ConfirmConversions:=False, ReadOnly:=True)
objWord.Visible = False
Set qDoc = ActiveDocument
Set MyRange = objWord.ActiveDocument.Content
MyRange.Copy
qDoc.Bookmarks("InfosContrat").Range.PasteAndFormat wdChartPicture
objWord.Documents.Close SaveChanges:=wdDoNotSaveChanges
objWord.Quit
Set objWord = Nothing |
Avec ce code, le texte (juste la première page, je ne sais pas pourquoi) s'insère bien comme je le veux, sous le format d'une image. Mais lorsque je change
qDoc.Bookmarks("InfosContrat").Range.PasteAndFormat wdChartPicture
en
qDoc.Bookmarks("InfosContrat").Range.PasteAndFormat wdFormatOriginalFormatting
, Word plante...HELP ME PLEASE
Partager