Bonjour,

j'exporte depuis Excel des graphiques en image word je cherche alors a compter le nombre d'images dans le doc word. Voici le code:
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
27
28
29
Function ExportGraphRest(wsSheet As Worksheet, sChemin As String, sGraphNum As String, sTitre As String)
 
        Dim lNbFigures As Long
 
        Set WdApp = Word.Application
        Set WdDoc = GetObject(sChemin)
        WdApp.Visible = True
 
        ''Dim Shp As Shape
        Dim i As Long
 
        'For Each Shp In WdDoc.Shapes
        ' i = i + 1
        ' Next Shp
        ' i = Documents(sChemin).Shapes.Count
 
        wsSheet.Select
        wsSheet.ChartObjects("Graphique " & sGraphNum).Activate
        ActiveChart.ChartArea.Select
        ActiveChart.ChartArea.Copy
 
        WdApp.Selection.EndKey Unit:=wdStory, Extend:=wdMove
        WdApp.Selection.TypeParagraph
        WdApp.Selection.Paste
        WdApp.Selection.TypeParagraph
        WdApp.Selection.TypeText ("Figure " & i & ": " & sTitre)
        Application.CutCopyMode = False
 
End Function
Le i reste a 0 .

Merci !