Convert linked Excel charts to embedded Excel charts
Problem
You want to convert linked Excel charts to embedded charts, perhaps so you don't need to keep track of linked files when moving the PowerPoint files from one place to another.
Solution
This macro will convert linked Excel charts to embedded ones. Note that it will only work in PowerPoint 2003.
Not earlier versions; not later versions.
It doesn't copy any animation settings or change the order of the shapes, though it will copy the sizing and position of the original linked chart to the new embedded one.
Please try it only on a COPY of your valuable original presentation.
Sub EmbedLinkedCharts()
' Convert linked Excel charts to embedded charts
' Only works with PPT 2003
Dim oSh1 As Shape
Dim oSh2 As Shape
Dim oSl As Slide
Dim x As Long
For Each oSl In ActivePresentation.Slides
For x = oSl.Shapes.Count To 1 Step -1
Set oSh1 = oSl.Shapes(x)
With oSh1
' is it a linked object?
If .Type = msoLinkedOLEObject Then
' is it an excel chart
If InStr(UCase(.OLEFormat.ProgID), "EXCEL.CHART") > 0 Then
.Copy
Set oSh2 = oSl.Shapes.PasteSpecial(ppPasteOLEObject)(1)
oSh2.Top = .Top
oSh2.Left = .Left
oSh2.height = .height
oSh2.width = .width
.Delete ' oSh1
End If
End If
End With
Next ' shape
Next ' slide
End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.