1 pièce(s) jointe(s)
Automation: modifier un graphique excel intégré à un Powerpoint
Bonjour à tous,
Après quelques jours de recherche, je rencontre un point bloquant: je n'arrive pas à modifier les données d'un graphique excel intégré à un powerpoint. J'ai essayé de nombreuses solutions, mais je n'arrive pas à instancier l'objet pour accéder à ses propriétés.
Voici mon code, ainsi que (ci-joint) un exemple d'objet excel dans un powerpoint.
Code:
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
| Public Function objet_ppt()
Dim ppt As PowerPoint.Application
Dim pi As PowerPoint.Presentation
Dim sh As PowerPoint.Shape
Dim sr As PowerPoint.ShapeRange
Dim ob As Excel.Workbook
Set ppt = New PowerPoint.Application
Set pi = ppt.Presentations.Open(FileName:="c:\matrice.pptx") ' Ouvre le PPT
For Each sh In pi.Slides(1).Shapes
' test If sh.Type = msoOLEControlObject Then MsgBox sh.Type & vbCrLf & sh.Name & vbCrLf & TypeName(sh)
' Ce code fonctionne pour les excel 2003 intégrés dans les powerpoint, mais pas dans mon cas:
with sh.OLEFormat.Object.WorkSheets(onglet).range("a1:ia5000")
Set c = .Find("@", LookIn:=-4123, LookAt:=2, SearchOrder:=1, MatchCase:=False)
If Not c Is Nothing Then
Firstaddress = c.Address
Do
'traitement
Loop While Not c Is Nothing
End If
End With
Next
End Function |
J'obtient le code d'erreur suivant: -2147188160 (impossible d'instancier un objet OLE)
Quelqu'un saurait-il comment accéder à cet objet pour modifier ses données?
En vous remerciant,