[HILFE] - Laufzeitfehler 424 nach Office Upgrade a
23.06.2016 12:17:08
Mark
Hallo zusammen,
mein VBA läuft nicht mehr nach einem Upgrade von Office 2010 auf 2013.
Ich brauche dringend Hilfe!
Es lief reibungslos unter 2010. Der Code dient dazu um aus Excel eine Tabelle als
Bild, ein Diagramm sowie ein Text in PowerPoint einzufügen.
FEHLER: Laufzeitfehler '424': Objekt erforderlich
Kann mir da bitte jemand weiterhelfen? Wie könnte denn der Code unter 2013 aussehen? Habe fast alles schon vergeblich versucht.
Viele Grüße,
Mark
Anbei der VBA CODE (Fett markierte Zeile wird beim Fehler hervorgehoben):
Private Sub GenOne(ppApp As Variant, ppFile As Variant, ppSlide As Variant, objShape As Variant, _
_
_
_
_
_
_
WS1 As Worksheet, WS2 As Worksheet, iCell As Integer, iCell2 As Integer, iCell3 As Integer, _
rngCopyRange, strChart, strName)
ppApp.Visible = msoTrue
'Define Variables for the Table
Dim PastePositionLeft As Integer
Dim PastePositionTop As Integer
Dim PastePositionHeight As Integer
Dim PastePositionWidth As Integer
Dim PasteTableAsDefined As Integer
'Define Variables for the Chart
Dim PastePositionLeftChart As Integer
Dim PastePositionTopChart As Integer
Dim PastePositionHeightChart As Integer
Dim PastePositionWidthChart As Integer
'Define the Paste Position in [cm] for the Table
PastePositionLeft = Application.CentimetersToPoints(14.84)
PastePositionTop = Application.CentimetersToPoints(9.68)
PastePositionHeight = Application.CentimetersToPoints(8.1)
PastePositionWidth = Application.CentimetersToPoints(17.31)
'Define the Paste Position in [cm] for the Chart
PastePositionLeftChart = Application.CentimetersToPoints(14.84)
PastePositionTopChart = Application.CentimetersToPoints(4.12)
PastePositionHeightChart = Application.CentimetersToPoints(4.51)
PastePositionWidthChart = Application.CentimetersToPoints(17.3)
'Activate the defined Worksheet, if the Total Value on Sheet1 is bigger than "0"
If WS1.Cells(iCell, iCell2).Value > 1 Then
WS2.Activate
'Copy the defined Table and paste it to a new PPT-Slide with the defined measures
Set ppSlide = ppFile.Slides(1)
ppSlide.Copy
ppFile.Slides(ppFile.Slides.Count).Select
ppApp.ActivePresentation.Slides.Paste(ppFile.Slides.Count + 1).Select
'Select the defined Copy range for the Table
rngCopyRange.Select
'Copy the defined Range for the Table as a Picture
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
'Paste the selected Table into the PPT-Slide
ppApp.ActiveWindow.Selection.sliderange.Shapes.Paste.Select
ppApp.ActiveWindow.Selection.ShapeRange.LockAspectRatio = msoFalse
ppApp.ActiveWindow.Selection.ShapeRange.Left = PastePositionLeft
ppApp.ActiveWindow.Selection.ShapeRange.Top = PastePositionTop
ppApp.ActiveWindow.Selection.ShapeRange.Height = PastePositionHeight
ppApp.ActiveWindow.Selection.ShapeRange.Width = PastePositionWidth
With ppFile.Slides(ppFile.Slides.Count).Select
'Select the defined Chart that has to be copied
ActiveSheet.ChartObjects(strChart).Activate
ActiveChart.ChartArea.Copy
ActiveChart.ChartArea.Select
With ppApp.ActiveWindow.Selection.ShapeRange
'Paste the defined Chart into the PPT-Slide
ppApp.ActiveWindow.Selection.sliderange.Shapes.Paste.Select
ppApp.ActiveWindow.Selection.ShapeRange.LockAspectRatio = msoFalse
ppApp.ActiveWindow.Selection.ShapeRange.Left = PastePositionLeftChart
ppApp.ActiveWindow.Selection.ShapeRange.Top = PastePositionTopChart
ppApp.ActiveWindow.Selection.ShapeRange.Height = PastePositionHeightChart
ppApp.ActiveWindow.Selection.ShapeRange.Width = PastePositionWidthChart
End With
End With
End If
End Sub