Hello,
I have a piece of code that I have used successfully many times going through different ranges in excel (mainly containing charts) and pasting theme into powerpoint as images.
Now I need to do the same but paste the charts as chart objects instead.
Any tips?
*
Sub open_ppt()
Dim ppApp As PowerPoint.Application
Dim pppres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Set ppApp = New PowerPoint.Application
ppApp.Visible = True
ppApp.Presentations.Open "C:\Users\XXX\Template.pptx"
Set pppres = ppApp.ActivePresentation
ppApp.Visible = True
' Using a specifik sheet (Master) containing information regarding the different ranges (named as image1, image2 etc).
For i = 1 To 8
Sheets("Master").Select
Range("b80").Select
ActiveCell.Offset(i, 0).Select
image = ActiveCell.Value
Range("c80").Select
ActiveCell.Offset(i, 0).Select
imageobj = ActiveCell.Value
Range("a80").Select
ActiveCell.Offset(i, 0).Select
Slide = ActiveCell.Value
Range("d80").Select
ActiveCell.Offset(i, 0).Select
pict_height = ActiveCell.Value
Range("e80").Select
ActiveCell.Offset(i, 0).Select
pict_width = ActiveCell.Value
Range("f80").Select
ActiveCell.Offset(i, 0).Select
pict_tb = ActiveCell.Value
Range("g80").Select
ActiveCell.Offset(i, 0).Select
pict_lr = ActiveCell.Value
Application.Goto Reference:=image
ActiveSheet.Range(image).CopyPicture xlScreen, xlPicture
ppApp.Visible = True
With pppres.Slides(Slide).Shapes.Paste
.Name = image
End With
With pppres.Slides(Slide).Shapes(image)
.Height = pict_height
.Width = pict_width
.Left = pict_lr
.Top = pict_tb
End With
Next i
End Sub
I have a piece of code that I have used successfully many times going through different ranges in excel (mainly containing charts) and pasting theme into powerpoint as images.
Now I need to do the same but paste the charts as chart objects instead.
Any tips?
*
Sub open_ppt()
Dim ppApp As PowerPoint.Application
Dim pppres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Set ppApp = New PowerPoint.Application
ppApp.Visible = True
ppApp.Presentations.Open "C:\Users\XXX\Template.pptx"
Set pppres = ppApp.ActivePresentation
ppApp.Visible = True
' Using a specifik sheet (Master) containing information regarding the different ranges (named as image1, image2 etc).
For i = 1 To 8
Sheets("Master").Select
Range("b80").Select
ActiveCell.Offset(i, 0).Select
image = ActiveCell.Value
Range("c80").Select
ActiveCell.Offset(i, 0).Select
imageobj = ActiveCell.Value
Range("a80").Select
ActiveCell.Offset(i, 0).Select
Slide = ActiveCell.Value
Range("d80").Select
ActiveCell.Offset(i, 0).Select
pict_height = ActiveCell.Value
Range("e80").Select
ActiveCell.Offset(i, 0).Select
pict_width = ActiveCell.Value
Range("f80").Select
ActiveCell.Offset(i, 0).Select
pict_tb = ActiveCell.Value
Range("g80").Select
ActiveCell.Offset(i, 0).Select
pict_lr = ActiveCell.Value
Application.Goto Reference:=image
ActiveSheet.Range(image).CopyPicture xlScreen, xlPicture
ppApp.Visible = True
With pppres.Slides(Slide).Shapes.Paste
.Name = image
End With
With pppres.Slides(Slide).Shapes(image)
.Height = pict_height
.Width = pict_width
.Left = pict_lr
.Top = pict_tb
End With
Next i
End Sub