Linking Spreadsheets into Powerpoint using VBA?

t_page

New Member
Joined
Oct 27, 2008
Messages
1
I've been working on a problem where I am wanting to automate the process of linking spreadsheets to Powerpoint slides. I have the following code which copies charts over to Powerpoint and am wanting to alter this so that it works for linking a selected range. Can anbody please help me?

________________________________________________

Sub test()
' Excel Application objects declaration
Dim objSheet As Worksheet
Dim objChartObject As ChartObject
Dim objChart As Chart
'Powerpoint Application objects declaration
Dim pptApp As Object 'Powerpoint.Application
Dim pptPre As Object 'Powerpoint.Presentation
Dim pptSld As Object 'Powerpoint.Slide
'Create a new Powerpoint session
Set pptApp = CreateObject("Powerpoint Application")
'Create a new presentation
Set pptPre = pptApp.Presentations.Add

For Each objSheet In ActiveWorkbook.Worksheets
If objSheet.ChartObjects.Count > 0 Then
For Each objChartObject In objSheet.ChartObjects
Set objChart = objChartObject.Chart

Set pptSld = pptPre.Slides.Add(pptPre.Slides.Count + 1, 12)
With objChart

objChart.CopyPicture xlScreen, xlBitmap, xlScreen
pptSld.Shapes.Paste
End With
Next objChartObject
End If
Next objSheet

pptApp.Visible = True
pptApp.Activate
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,215,831
Messages
6,127,142
Members
449,363
Latest member
Yap999

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top