Exporting charts outside excel

S

sduffield

I was hoping to record a macro that copied an excel chart and pasted it into
a ppt slide but the record function in Excel 2007 stopped as soon as I
started working outside excel.

How do I transfer information (without links if possible) such that I could
build a ppt deck with charts from a single excel workbook?

Thanks
S
 
T

Tim Williams

You'll need to add a reference to the Microsoft PowerPoint XXX library
(in the VB Editor go to Tools > References)
Start with a presentation open in PowerPoint

Tim

'***********************************
Sub Tester()

Dim pp As PowerPoint.Application
Dim ppAP As PowerPoint.Presentation
Dim s As PowerPoint.Slide
Dim c

On Error Resume Next
Set pp = GetObject(, "Powerpoint.Application")
On Error GoTo 0

If Not pp Is Nothing Then

Set ppAP = pp.ActivePresentation

For Each c In ThisWorkbook.Sheets("Sheet1").ChartObjects

c.CopyPicture

Set s = ppAP.slides.Add( _
ppAP.slides.Count + 1, _
ppLayoutBlank)
s.Shapes.Paste
With s.Shapes(1)
.Left = 20
.Top = 20
.ScaleWidth 1.5, msoTrue
.ScaleHeight 1.5, msoTrue
End With

Next c
Else
MsgBox "Open your ppt presentation first"
End If

End Sub
'***********************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top