How to Include exl charts from closed worksheets into PPT slides

  • Thread starter Thread starter akshetrapal
  • Start date Start date
A

akshetrapal

Hi,

I have writting a macros for creating charts from the data in the excel
sheet. These charts are stored in a worksheet called 'Charts'.

Now i am creating a macro in powerpoint presentation where i want the
macro to open the excel sheet and include 1 charts in 1 slide.

After all the charts have been included the macro should save the ppt
and close the excel sheet.

Can someone help me on this?

Thanks
Aditya
 
Have you tried to export the chart as a gif file and insert it as
picture into the presentation
 
Here's some sample code from Samples.Xls (supplied with some versions of
Excel).

Sub MS_PowerPoint()
Dim ppt As Object, pres As Object
'Create a Microsoft PowerPoint session
Set ppt = CreateObject("powerpoint.application")
'Copy the chart on the Chart Labels sheet
Worksheets("Chart Labels").ChartObjects(1).Copy
'Make PowerPoint visible
ppt.Visible = True
'Activate PowerPoint
AppActivate ppt.Name
'Open a new document in Microsoft PowerPoint
Set pres = ppt.Presentations.Add
'Add a slide
pres.Slides.Add 1, ppLayoutBlank
'Paste the chart
ppt.ActiveWindow.View.Paste
Set ppt = Nothing
End Sub


--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 
I have a several hints for dealing with Excel and PowerPoint together:

http://peltiertech.com/Excel/XL_PPT.html

One of the examples will paste each chart embedded in the active sheet
onto its own slide. Using the object browsers for both VB Editors
(Excel's and PowerPoint's) should help you figure out how to save the
presentation and close the worksheet.

- Jon
 
Back
Top