AW: Charts von Excel per VBA nach Powerpoint kopieren
08.09.2011 09:22:12
Excel
Servus Moritz,
ich habe das einmal gemacht über die CopyPicture Funktion. Die scheint aber nicht bei jedem vorhanden zu sein. Ich schrieb dir mal das grobe Vorgehen hier als Code auf und du kannst ja mal probieren, ob das in deiner Excel-Version läuft.
Was bei dir jetzt nicht aus dem Code hervorgeht ist:
Soll eine neue PPT erstellt werden oder eine bestehende geöffnet werden?
Wie wird bestimmt, auf welche Folie das Chart kommen soll?
Soll es evtl. als richtiges ChartObject eingefügt werden, oder reicht das Bild?
Sub ChartsToPPT()
Dim crt As ChartObject
Dim pApp As Object
Dim pres As Object
Dim sld As Object
Dim shp As Object
Dim sFile As String
Set pApp = CreateObject("PowerPoint.Application")
sFile = Application.GetOpenFilename("Powerpoint Presentations (*.ppt), *.ppt")
Set pres = pApp.Presentations.Open(sFile)
For Each crt In Me.ChartObjects
crt.CopyPicture xlScreen, xlPicture
Set sld = pres.Slides.Add(pres.Slides.Count + 1, 12)
Set shp = sld.Shapes.Paste
Next crt
pApp.Visible = True
Set pres = Nothing
Set pApp = Nothing
End Sub
So sah das ganze in etwa bei mir aus.
Über shp kannst du das Ganze gut bearbeiten.