Hi,
I want after I select slide, copy there charts from excel, I have code as below:
I got error like: Object variable or with block wariable not set
I want after I select slide, copy there charts from excel, I have code as below:
Code:
Set wb = ActiveWorkbook
Set ws2 = wb.Worksheets("C2")
Dim newPowerPoint As PowerPoint.Application
Dim activeSlide As PowerPoint.Slide
Dim cht As Excel.ChartObject
Set newPowerPoint = New PowerPoint.Application
newPowerPoint.Presentations.Open "C:\temp.pptx"
newPowerPoint.ActiveWindow.View.GotoSlide (5)
ws2.Activate
ws2.ChartObjects("Chart 1").Chart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
activeSlide.Shapes.Paste ' here I got error
With activeSlide.Shapes(1)
If .Type = msoPicture Then
.Top = 60
.Left = 0
.Height = 350
.Width = 320 'szerokosc
End If
End With
I got error like: Object variable or with block wariable not set