Martin1991
New Member
- Joined
- Nov 14, 2017
- Messages
- 24
Hello,
I was trying to look up for this formula, but can´t specify correctly the way of slide in PPT presentation, where i need to copy in some informations from the sheets.
Debugger comes with "error 429 :ActiveX component can´t create and object" stopping at part Rang3 = ActivePresentation.Slides.Range(Array("Slide3")) , where i try to define path to slide. FYI I m new to vba and i think it will be easy for someone more advanced, but can´t find the right solution even on forums.
Please, could you help someone?
I was trying to look up for this formula, but can´t specify correctly the way of slide in PPT presentation, where i need to copy in some informations from the sheets.
Code:
Sub CopyToPPoint()
Dim newPowerPoint As PowerPoint.Application
Dim activeSlide As PowerPoint.Slide
Dim PPPres As PowerPoint.Presentation
Dim cht As Excel.ChartObject
'Look for existing instance
On Error Resume Next
Set newPowerPoint = GetObject(, "PowerPoint.Application")
On Error GoTo 0
If newPowerPoint Is Nothing Then
Set newPowerPoint = New PowerPoint.Application
newPowerPoint.Visible = True
Set PPPres = newPowerPoint.Presentations.Open("D:\docs\just_practise_soon_to_delete\EU Weekly pending report 2017'Wxx.pptx")
Else
Set PPPres = newPowerPoint.ActivePresentation
End If
newPowerPoint.ActiveWindow.ViewType = ppViewSlide
Rang3 = ActivePresentation.Slides.Range(Array("Slide3"))
PasteRng PPPres, 3, Range("Rang3")
AppActivate ("Microsoft PowerPoint")
Set activeSlide = Nothing
Set newPowerPoint = Nothing
Set PPPres = Nothing
End Sub
Sub PasteRng(Pres, SlideNo, Rng As Range)
Dim PPPres As PowerPoint.Presentation
Rng = Worksheets("3").Range("A1:N30")
SlideNo = PPSlide.SlideIndex("3")
Rng.CopyPicture Appearance:=xlScreen, Format:=xlBitmap ' copy the range
Pres.Application.ActiveWindow.View.GotoSlide SlideNo 'PPSlide.SlideIndex ' activate the slide no
Pres.Application.ActiveWindow.View.PasteSpecial ppPasteOLEObject, msoFalse ' paste using pastespecial method
End Sub
Debugger comes with "error 429 :ActiveX component can´t create and object" stopping at part Rang3 = ActivePresentation.Slides.Range(Array("Slide3")) , where i try to define path to slide. FYI I m new to vba and i think it will be easy for someone more advanced, but can´t find the right solution even on forums.
Please, could you help someone?