Powerpoint obj customization - vba

Is it possible to resize the "rectangle" Object in the power point depending on the excel data in a cell using excel vba? if yes please tell me some steps to process it

Related

Change default slide-size on PowerPoint 2010

I use PowerPoint 2010 and need to create automatically PowerPoint (with excel VBA) with the slide size 16:9, so I would like to set this value as the default one (instead of 4:3). Could someone help me ? Or does someone maybe know how to choose this Slide-Size with excel VBA ?
Thanks for your help !
Charlotte

PowerPoint 2013 "PasteSpecial" won't embed Excel chart as OLE Object

I've written a macro in PowerPoint that, as part of its process, will convert a linked chart in a PowerPoint presentation to an embedded chart by copying the source Excel chart and pasting that copied chart in as an OLE object -- the specific command is, "sldComponent.Shapes.PasteSpecial(ppPasteOLEObject)".
Until today, this has worked fine in all versions from 2003 to 2010. However, when trying to run this function in 2013/365, I keep getting a run-time error stating "The specified data type is not available" (-2147188160 / 80048240). I also notice that in the Microsoft Developers Reference webpage, "ppPasteOLEObject" is no longer listed as an acceptable datatype for the PasteSpecial method (when used with the Shapes collection).
I have found several ways to programmatically paste the chart as a picture, but whenever I click on the pasted chart and try to access the data, I keep getting the message "The linked file is not available." I want the data to be entirely self-contained so the PowerPoint user can edit it without reference to the original Excel file. Interestingly, when I stop the PowerPoint macro at the buggy line and then manually click "Paste" on the ribbon, the copied chart does paste, fully embedded with data accessible, into the active slide -- so the chart is getting copied into the Clipboard; the PowerPoint macro is simply unable to read and paste it for some reason. Even more interestingly (read: frustratingly), the PasteSpecial(ppPasteOLEObject) command will work for tables copied from Excel, i.e. cell ranges, but not for charts.
What happened? How does one use VBA code in PowerPoint 2013 to embed (i.e. insert a previously-created, self-contained Excel chart including all data right in the presentation slide) an Excel chart in the new version?
ADD: I should also note that the command used to get the chart from the source worksheet in Excel is "xlCopySheet.ChartObjects(1).Select", then "appExcel.Selection.Copy". Is the problem that the chosen Copy syntax is not capturing the entire chart including data but only the display? What is the correct Copy syntax to use here?
ADD 2: Further specification: The original macro was saved and was running with both Excel and PowerPoint in Compatibility (97-2003) mode, although the apps themselves are the 2013/Office 365 versions.
If you paste the chart as a "Microsoft Office Graphic Object", the chart is pasted as an Excel chart. You can format it within PowerPoint using the Excel ribbon's Chart Tools tab, which appear in PowerPoint. If you click any of the edit/select data buttons, it opens the data in Excel.
If you paste the chart as a Microsoft Excel Chart Object, it is pasted as an embedded workbook (the entire workbook, not just the chart and its data), with a new chart sheet inserted in the embedded workbook, and this chart sheet is what is visible. You need to double click to format or edit the chart, which opens the embedded workbook in Excel, and may mess up the size of the embedded object (so it's chart-sheet sized, not chart-embedded-in-the-worksheet sized) and things like font size.
If I copy the chart in Excel and use this in the PowerPoint VB Immediate Window
activepresentation.Slides(3).Shapes.PasteSpecial ppPasteOLEObject
I get the second behavior.
You might want to try copying the chart using this:
xlCopySheet.ChartObjects(1).Chart.Copy

Create PPT Chart based on Excel information

I have a table in PPT that I copied over from excel and I want to create a PPT chart based on that information through VBA. What I want to know is, is there a way to create a chart based off of that table and not off of the little excel spreadsheet that PPT automatically opens? Any help would be greatly appreciated.
If the chart is inserted in the slide from PowerPoint itself, the chart uses the PowerPoint DataSheet as its data source. You can open this PowerPoint DataSheet in Excel and link it to the Excel data you want to plot.
Alternatively you can make the chart in Excel based on the Excel data, then copy the chart and paste it (using onw of the link options) into PowerPoint. It will behave as a native PowerPoint chart (which is really a native Excel chart) but it will be based on the Excel data.

Update charts in PowerPoint in VBA

I have a couple charts in a powerpoint presentation that I want to write a macro for to update them automatically. I have a database that will export data as excel spreadsheets and I was wondering if there was a way in either excel vba or powerpoint vba to have the user input the location of the new data file and have that new data copied and pasted so that the chart will update. I am new to VBA so any help would be greatly appreciated.
You can easily do this by editing link to the ppt charts to the new file.
Simply go to the
Excel Option Button>>Prepare>>Edit Links to Files and change source of the charts to the new file.
Let me know if you still want/need to use VBA for this.
Cheers

Can one use VBA to create a new chart type in PowerPoint?

I don't believe this is possible, but I would love to have confirmation from PowerPoint VBA experts.
I am trying to make a chart in PowerPoint that is essentially a bar graph whose bars have a variable width (i.e. the width of each bar is an input into the chart, as opposed to your classic bar chart, which has a set width for each bar). This is of course not possible in PowerPoint as there is no such chart type for this.
Is it possible to use VBA code to create something like this? I have a hunch that it is not and that I am limited to interacting with the PowerPoint library and the set chart types.
Any insight into this will be greatly appreciated. I am struggling to think of a solution for displaying my data in this particular manner.
Something like the chart in this tutorial: Variable Width Column Charts (Cascade Charts)? It's probably easier to do in Excel, because the data isn't a layer further removed from the chart, but you could follow the same protocol in PowerPoint. This is a manual protocol; I've written VBA to do it in Excel, and I'm going to do the same for PowerPoint when I get a chance.