VBA code to change size of one slide only in powerpoint - vba

how can I change the size of one slide in a presentation using VBA?
I know the PageSetup.SlideWidth and PageSetup.SlideHeight properties, but these work on the presentation and as a result on all slides.
I'm sure this is possible, since you can do this manually in powerpoint.
Thanks a lot!

You can't. Not under program control, not manually.

Related

PoiwerPoint auto-updating text boxes

I want to know if there is a way to link text boxes in PowerPoint in a similar fashion as Excel so that when I update one text box (for instance, changing the title of the presentation), the other linked text boxes will update by themselves. The purpose is to avoid having to go through the whole presentation to change manually every relevant slides. I don't think there is a build in function but I am fairly new to VBA in PowerPoint (have some experience with Excel already). Any input is very much appreciated, thank you!

Slide format getting changed when we paste a slide to new presentation

We are working on PowerPoint add-in application. In this application, we have a feature for programmatically create the presentation using slides. In between, we noticed an issue related to slide formatting.
The issue is, when we copy a slide in a presentation to new presentation, it seems that the slide format is getting changed. This issue is not related our add-in application. You can see the issue in PowerPoint itself.
Original slide in the presentation
When we copy slide to the new presentation, the format seems to get changed
You can see that graph section getting changed.
When we paste the slides, we will get following options. “Use destination Theme”, “Keep Source formatting” and “Picture”. Even if we selected the “Keep Source Formatting” option, our issue not gets resolved. When we paste the slide using “Picture” option it worked well, But we can’t edit such slides.
How do we paste the slide with the correct format and editable option? Is there any way to solve this issue? Any help would be appreciable.
Presentation link
https://docs.google.com/presentation/d/1uBmQukvmY5XflMXK1-3m0YXzCp4AXSh3Jknj1E_EpQU/edit?usp=sharing

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.

A Text value change on Powerpoint by using OpenXml doesn't fit

I use OpenXml for creating custom powerpoint presentation in this way: I put a keyword on the presentation, I found it during process with OpenXml and change the text value. Everything work fine but the fit option doesn't work at first.
The text box has options "Autofit: Shrink text on overflow; Wrap text in shape: On"
After my process, the new text appear on the right place but the autofit is not done, I need to click on the text box and make a input for see the autofit work. I think that PowerPoint only check option after a modification.
What I want is the autofit option is called at the end of the process. Can anyone help me?
I hope you understand what I want to do.
Thanks.
It's not possible using just OpenXML. The <a:normAutofit/> tag is used by a client application, such as PowerPoint, to render the text larger or smaller, as needed. OpenXML doesn't actually render anything, so until the client does, it will just read the text as if it is not auto-fitted.
There are a few options to think of to control this - none of them great however. One would be to use VSTO or VBA in PowerPoint to check all shapes on PPTX open and if they have a AutoFit tag, to re-render them. A second way would be to do all the font measurements yourself based on the shape's width & height and then set the font scale to the appropriate percentage. Another would be to make a textbox large enough to fit the largest amount of text you will ever insert and then turn autofit off.
Sorry this doesn't really help you immediately. I've done tons of research on this particular subject and it's all bad news.

Programmatically set a picture as a powerpoint background through file embedded on an excel template

I'm generating a PPT presentation through vba in excel, everything is working just fine except that Im being asked to automatically set background of the power point (which it wouldn't be much a problem) but this will be done with a picture that is actually embedded on the macro, so I dont have physical path to reference the picture, plus the excel is generated on the fly according to the user inputs.
so.. has anyone achieved this : Programmatically set a slide backrground from vba excel with a picture that is embedded on a sheet?
Thanks!
As far as i understand, you want to set the background of the slides in vba (it doesn't matter it is called from Excel).
Let's assume you have the path in a var:
Dim osld As Slide
Set osld = ActivePresentation.Slides.Range 'every slides of the presentation
'This is important in some cases
osld.FollowMasterBackground = False
With osld.Background.Fill
.UserPicture <string var containing path to image>
End With
End Sub
You will also have to adapt ActivePresentation with the PPT object you built from your previous code.
If you can't find a way to set the background directly from a picture in memory, what about copy/pasting the picture from Excel into the Slide Master(s) in your PPT presentation then sending them to the back so they sit behind everything. The effect would be nearly identical from the user's point of view, I think.