![]() ![]() Please recheck your selections in both PowerPoint and Excel and try again. MsgBox "An error occurred the transfer was not successful. MsgBox "You need to have powerpoint open and an object selected to use this macro" Set PPApp = GetObject(, "PowerPoint.Application") 'Credit to Jon Peltier for the initial code Linking data (icons 3 and 4) keeps your PowerPoint and Excel file in sync. If you're going back and forth between the two apps, linking might be a better choice. Sub ExcelChartReplacesExistingPowerPointChartAsPicture() The major downside to embedding data is that it doesn't stay synced to the Excel file that you're doing analysis and data review inside of. (be sure to set a reference to PPT in VBA) Just an alternative to consider, if you can't get the linking to work. You could modify this by naming each of your images in PPT with a unique name, and naming each Excel graph with a correlated name, then instead of using the selected graph(s) and image(s), just cycle through every graph, look in the active PPT for aĬorrespondingly named image, then replace using the core part of this code. Then we update the graph source, and paste in the next set of data onto a different PPT slide. The code below will take the selected graph and the selected image in powerpoint, and copy/resizeĪ new version from Excel to PPT. My situation is slightly different in that we re-use source graphs (dynamic source range selection) instead of creating loads of graphs in the source workbook. Although not as nice as just having everything linked and updating automatically, you might want to consider this fairly automated alternative.
0 Comments
Leave a Reply. |