Log in

View Full Version : Reapplying text box alignments



Ritterbruder
11-11-2016, 10:51 AM
I am in the process of reformatting hundreds of slides from 4:3 ratio to 16:9 ratio and applying a new template

I have written a .NET automation script which works as designed. It iterates through PPTs, changes the ratio to 16:9, and applies a new template.

However, there are several slides where the spacing of the text boxes are off.

This one worked OK:

Before:
17569
After:
17570

This one did not:

Before:
17571
After:
17572

As you can see, in the second one, the text box is out of alignment. I did a test off to the side and noticed that this happens if the user dragged and moved the text box in the original slides. This prevents the template's text box alignments from being applied.

Does anyone know how to correct this? I believe this may have something to do with the slide master. By moving the text box, the slide no longer follows the slide master. Is there a way to reapply the alignments from the slide master?

Thanks

John Wilson
11-12-2016, 08:23 AM
You could try:


Dim osld As Slide


For Each osld In ActivePresentation.Slides
osld.CustomLayout = osld.CustomLayout
Next osld

Failing that try CommandBars.ExecuteMso ("SlideReset") (With a selected slide)

Ritterbruder
11-14-2016, 07:36 AM
Hi John,

The code doesn't work. But thanks for telling me about "SlideReset". I noticed that if I right-click on a slide on the carousel and click on "Reset Slide", it does exactly what I would like it to do.

17581

Is there a way this can be done via automation? Thanks!

Ritterbruder
11-14-2016, 07:42 AM
Hi John,

Never mind I figured it out. I was doing it via an external .NET application, so I have to make the call to PowerPoint.Application first.

Dim ppt As PowerPoint.Application
ppt = CreateObject("PowerPoint.Application")

Dim slides As PowerPoint.Slides
Dim slide As PowerPoint.Slide


For Each slide In slides
ppt.CommandBars.ExecuteMso("SlideReset")
Next

Thanks for the help!