This is awesome! Is there a way to change this so that I can assign the Macro to a chart so that it only enters the chart you click into PPT? Not all charts?
Thanks so much!
Something like this?
Sub PushActiveChartToPPT()
'Set reference to 'Microsoft PowerPoint 12.0 Object Library'
'in the VBE via Tools > References...
'
Dim ppt As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation
Dim pptSld As PowerPoint.Slide
Dim pptCL As PowerPoint.CustomLayout
Dim pptShp As PowerPoint.Shape
If ActiveChart Is Nothing Then
MsgBox "Please select a chart to copy to PowerPoint"
Else
'Get the PowerPoint Application object:
Set ppt = CreateObject("PowerPoint.Application")
ppt.Visible = msoTrue
Set pptPres = ppt.Presentations.Add
'Get a Custom Layout:
For Each pptCL In pptPres.SlideMaster.CustomLayouts
If pptCL.Name = "Title and Content" Then Exit For
Next pptCL
'Get a slide:
Set pptSld = pptPres.Slides.AddSlide(pptPres.Slides.Count + 1, pptCL)
pptSld.Select
'Get a Placeholder on the slide:
For Each pptShp In pptSld.Shapes.Placeholders
If pptShp.PlaceholderFormat.Type = ppPlaceholderObject Then Exit For
Next pptShp
If pptShp Is Nothing Then Stop
'Copy the ActiveChart:
ActiveChart.ChartArea.Copy
'Paste into Ppt:
ppt.Activate
pptShp.Select
ppt.Windows(1).View.Paste
End If
End Sub
Cheers
Rich