------ Register to get rid of these "In Post" ads! ------
Category: Excel: VBA
Here is my goal:
Loop through active Excel workbook
Copy each chart (1 chart per worksheet)
Paste each chart onto a separate slide in PowerPoint
My code works fine, with one exception.
I need the code to paste the chart as embedded, keeping source formatting, with NO link to the original Excel file.
I WOULD, however, like to be able to right-click the chart in PowerPoint and be able to select EDIT DATA to open Excel and edit/view the data. This WITHOUT opening the original source file - just Excel.
Here is my code - much of which is attributed to Jon Pelletier and others:
Dim ppApp As Object 'PowerPoint.Application
Dim ppSlide As Object 'PowerPoint.Slide
Dim ppShape As Object 'PowerPoint.Shape
Dim ppChart As Object 'PowerPoint.Chart
Dim ws As Excel.Worksheet
Dim CO As Excel.ChartObject
'Try access to Powerpoint
On Error Resume Next
Set ppApp = GetObject(, "PowerPoint.Application")
On Error Goto 0
If ppApp Is Nothing Then
MsgBox "Open your presentation first."
'Visit each sheet
For Each ws In Worksheets
For Each CO In ws.ChartObjects
'Create a new slide, use the first slide as template
Set ppSlide = .Slides(.Slides.Count)
'Copy the chart to the slide
ppApp.ActiveWindow.ViewType = 1
Set ppShape = ppSlide.Shapes(ppSlide.Shapes.Count)
'Break the link to Excel
Set ppChart = ppShape.Chart
Hope I pasted my code properly!!