ich hab schon einiges gefunden für das kopieren aus Excel nach PowerPoint, aber ich bekomme das zentrieren einfach nicht hin.
Hier das Problem:
ich muss immer gleiche Charts auf verschieden folien kopieren und dazu noch ein kleiner Auschnitt einer Tabelle. Dieses muss auf der Folie als Metabild sein und dann an die richtige Position gerückt werden. Das Chart zentriert und die Tabelle rechts oben ins Eck. Das klappt auch schon aktuell auf einer Folie. Wähle ich nun aber die nächste an sind dort eine andere Anzahl von Objekten vorhanden und meine Shape-Index deklarierung ist für den A****.
Wie kann ich das lösen, dass er weiß welches Objekt er wo hinschieben muss?
Hier der VBA Code den ich benutze:
Sub CopytoPPTSlide1()
Dim PPApp As Object 'As PowerPoint.Application
Dim PPPres As Object ' As PowerPoint.Presentation
Dim PPSlide As Object ' As PowerPoint.Slide
' Reference existing instance of PowerPoint
'Optional Set ppt = New Powerpoint.Application 'ppt.Visible = True'ppt.Presentations. _
Open "c:\My Documents\ex_a2a.ppt"
On Error Resume Next ' Turn on error handling to check if PPT is running
Set PPApp = GetObject(, "Powerpoint.Application")
If Err.Number 0 Then MsgBox ("Powerpoint is not started, Please start!") ' if PPT is not _
_
_
_
_
running
Err.Clear
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
If Err.Number 0 Then MsgBox ("No presentation is open, Please open your presentation!") ' _
_
_
_
_
if no presentation is open
PPApp.ActiveWindow.ViewType = ppViewNormal
' Reference active slide
Set PPSlide = PPPres.Slides _
(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
Sheets(1).ChartObjects(1).Copy
' Paste copied picture
PPSlide.Shapes.PasteSpecial DataType:=2
PPSlide.Shapes(8).IncrementTop (215)
PPSlide.Shapes(8).IncrementLeft (312)
Sheets(1).Range("AE63:AH67").Copy
' Paste copied picture
PPSlide.Shapes.PasteSpecial DataType:=2
PPSlide.Shapes(9).IncrementTop (62)
PPSlide.Shapes(9).IncrementLeft (572)
With PPSlide.Shapes(9)
.Width = 120
End With
End Sub
Danke shconmal für die Hilfe
Grüße