Bonjour,

Je souhaiterai copier des tableaux depuis Excel vers des signets word.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Sub Export_vers_Visite_Chantier()
' Procédure permettant l'édition du rapport Visite de chantier
 
    Dim wordDoc As Word.Document
    Dim wordApp As Word.Application
    Dim chemin As String
    Dim i As Byte
 
    chemin = ThisWorkbook.Path ' Nom du chemin pour accéder au dossier de l'opération
 
    Set wordApp = New Word.Application
    Set wordDoc = GetObject(chemin & "\Rapports_types\Visite_chantier.docx")
    wordDoc.Application.Visible = True
 
    i = 1 ' faire tourner sur toutes les rubriques
    Range(Range(zone_recherche).Cells.Find(What:="DEBUT" & i & ".1").Offset(0, 1), Range(zone_recherche).Cells.Find(What:="FIN" & i & ".1").Offset(-1, 8)).Select
    Selection.Copy
 
    With wordApp
        .Selection.HomeKey Unit:=wdStory   ' envoie en début de page
        .Selection.Goto What:=wdGoToBookmark, Name:="Tableau1" ' recherche du signet
    End With
 
    wordApp.Selection.PasteSpecial link:=True, DataType:=wdPasteOLEObject, Placement:=wdInLine, DisplayAsIcon:=False
 
End Sub
Malheureusement, le code ci-dessus me retourne l'erreur d'exécution '91' : Variable objet ou variable de bloc With non définie à la ligne 20.

Auriez-vous une solution pour contourner ce programme ou une autre manière à me proposer pour copier mes tableaux Excel dans mon document word ?

Merci d'avance.