Updating Graphs from Excel to PowerPoint

mikedjp

New Member
Joined
Aug 21, 2007
Messages
12
Hi everyone,
I posted a question earlier today. I had a look over the link which was provided, but I dont think it was really what I was after.

I would like a program that operates from PowerPoint. On the heading line in the respective PowerPoint slides I would have the Graphs names, for instance: Hours vs Output. The ideal (probably unrealistic) program would then go to the active Excel workbook and loop through all the sheets. It would locate the correct graph and the copy paste the graph as a picture. The reason I need the graph to be pasted as a picture is that when I use the link feature in PowerPoint the file size is about three times bigger.

As said earlier, I tried to record a macro to learn the process but that only shows the copy paste action and doesn’t detail anything about my actions in Excel.

Ideas or further suggestions are greatly appreciated. Many thanks!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Paste link should be approximately the same size as pasting as a picture. Try this option again, to make sure you've done it correctly. Pasting the chart using regular settings will cause the PowerPoint file to balloon, since it stores the entire workbook behind the chart.
 
Upvote 0
Hi,
Thanks for your reply. I did it again and had the same result.

My actions were that I:
1. Copied the Chart from Excel
2. Pasted Special in PowerPoint - Paste Link - Microsoft Office Excel Chart Object (the only option) - ok
The above actions caused the file to be a little over double the size.

3. I then made sure that both the Charts were the same size in the different PowerPoint presentation I made to test the size.
4. I also then changed the link settings from Automatic to Manual: I did this by Edit links - Manual - Close

After the 3rd and 4th action the file with the links was again about three times the size of the file with the picture.

Since this is happening, do you think it is possible that I could create a program that simply copies and pastes the Chart as a picture (by looking up the Chart names in the active Excel workbook?

Thanks again for your help and sorry for asking such a simply question!
Have a nice day/night!
 
Upvote 0
What you want is possible. But first...

1. What version of Office?
2. What are the file sizes? I just did a test, and the presentation with paste special picture was 35 kb, the one with paste link was 45 kb, and a blank presentation was 8 kb. The linked one is a little bigger, because it contains a metafile picture plus the link information, but it's not twice the size.

The macro recorder only shaws what's happening in the app it's running in. You would need to record the Excel and PowerPoint actions, then when you combine them, reference them properly from the driving app to the other app.

There are some examples on this page, including one with PowerPoint retrieving content from Excel:

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

You could make a table in the workbook that lists all the charts to be copied to the presentation. The table would list the PowerPoint slide number, the dimensions (left, top, width, height) of the pasted object, the name of the pasted PowerPoint shape, the worksheet containing the chart, and the chart object's name. The program steps through the table one line at a time, deletes the existing Ppt shape on the referenced slide, finds and copies the chart, names it, repositions and resizes it, and moves to the next row. It stops when it reaches a blank row.

It's best to size and format the chart in Excel so little or nothing must be done in PowerPoint.
 
Upvote 0
Hi again,
1. I’m using Microsoft Office PowerPoint/Excel 2003.
2. In the presentation, I tested a four page presentation with three seperate charts. The copy paste picture file was 15kb and the other was 41kb.

I will have a look over the link you sent and let you know how it goes.

Thanks again!
 
Upvote 0
Hi,
I had a look at the most recent link that was sent and thought the one below (only first fee lines) sounded almost what I was after:

Sub ChartsAndTitlesToPresentation()
' Set a VBE reference to Microsoft PowerPoint Object Library
Dim PPApp As PowerPoint.Application
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim PresentationFileName As Variant
Dim SlideCount As Long
Dim iCht As Integer
Dim sTitle As String

I copied and pasted the formula to the VBA editor and tried to run it, but already on the first Dim it stopped; with a "compile error: User defined type not defined".

Not sure what the problem was. Thanks again for your help!
 
Upvote 0
Did you set a reference to the Microsoft PowerPoint Object Library? Go to VBE's Tools menu, References, scroll the list, check the appropriate box, and OK. Note: this particular code runs from Excel.
 
Upvote 0
Hi,
Great, I got past the Dim. Now I have a workbook (with two different charts) and a black presentation open.

The program now stops at:
For iCht = 1 To ActiveSheet.ChartObjects.Count

and then goes straight to:
Set PPSlide = Nothing

I will continue to try and work it out. Thanks so much for your help!

Have a good afternoon.
 
Upvote 0
Are the charts embedded in a worksheet or is each chart on its own sheet? The code you are using is based on charts embedded in a worksheet.
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,220
Members
448,554
Latest member
Gleisner2

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