Reset slide layout in VBA (PP2007)

L

Luca Brasi

In PP2007 I can reset a slide to the definitions of its custom layout
manually (tab Home, group Slides, button Reset).

Is there a way to do such a reset in VBA?

Thanks for any hints.
 
L

Luca Brasi

John, thanks for your message but it don't work.

Anyway, In my opinion the "Layout" property of the slide object
shouldn't be used anymore in PP2007, as PP2007 uses the new Custom
Layout concept. If you create some new custom slide layouts, the
"Layout" property just returns ppLayoutCustom which isn't really helpful.
 
S

Steve Rindsberg

Hi Luca,

Glad you showed up again.

This is re your earlier question about title masters.

If there's no Title Slide layout present, you can do

ActivePresentation.AddTitleMaster

In earlier versions of PPT, this adds a new title master. In 2007 it adds a
new Title Slide layout.

Now assuming you already have another layout that you want to designate as the
"Title Master", you could, I think, use the above, then copy all of the shapes
from your layout to the new one and you're done.
 
G

Guest

Thanks Shyam (and Luca) I missed the ref to 2007. I'll add that info to my
personal KB!!
 
L

Luca Brasi

Thanks Shyam, but I know that I can reapply a layout to a slide. My
question was about doing a "Reset" of a slide (like using tab Home,
group Slides, button Reset). In Office 2007 reapplying a layout and
reseting a slide are two different functionalities.

In short, resetting a slide does more than just reapplying a layout. For
example it also sets back the formatting of placeholder shapes (e.g.
font size).

After some more testing, I'm almost certain that no "easy" Reset
function in VBA exists (but maybe I missed something...?). I helped
myself now by creating a procedure that copies the formatting of all
placeholders in the custom layout to their respective shapes objects on
the slide.

Thanks anyway for all help.
 
C

Charlie

I reset slides with a custom layout by assigning them to themselves...

mySlide.CustomLayout = mySlide.CustomLayout



Luca Brasi wrote:

Reset slide layout in VBA (PP2007)
14-Sep-07

In PP2007 I can reset a slide to the definitions of its custom layou
manually (tab Home, group Slides, button Reset)

Is there a way to do such a reset in VBA

Thanks for any hints.

Previous Posts In This Thread:

Reset slide layout in VBA (PP2007)
In PP2007 I can reset a slide to the definitions of its custom layou
manually (tab Home, group Slides, button Reset)

Is there a way to do such a reset in VBA

Thanks for any hints.

Does this work?
Does this work

Dim oLay As PpSlideLayou
oLay = ActiveWindow.Selection.SlideRange(1).Layou
ActiveWindow.Selection.SlideRange(1).Layout = oLa

You maybe want to look at "Hands Off my Master" to
http://www.pptalchemy.co.uk/HandOff.htm

--
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.u
http://www.technologytrish.co.u
email john AT technologytrish.co.u

:

John, thanks for your message but it don't work.
John, thanks for your message but it don't work

Anyway, In my opinion the "Layout" property of the slide object
shouldn't be used anymore in PP2007, as PP2007 uses the new Custom
Layout concept. If you create some new custom slide layouts, the
"Layout" property just returns ppLayoutCustom which isn't really helpful

John Wilson wrote:

Luca,PPT 2007 requires a slightly different approach.
Luca
PPT 2007 requires a slightly different approach. All the change it needs is
to get the reference to the custom layout and it can be reapplied. Take a
look at this page
http://skp.mvps.org/2007/ppt002.ht

--
Regards
Shyam Pilla

Animation Carbon: Copy/Paste/Share animation libraries
www.animationcarbon.co



Thanks Shyam (and Luca) I missed the ref to 2007.
Thanks Shyam (and Luca) I missed the ref to 2007. I'll add that info to my
personal KB!
--
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.u
http://www.technologytrish.co.u
email john AT technologytrish.co.u

:

Hi Luca,Glad you showed up again.
Hi Luca

Glad you showed up again.

This is re your earlier question about title masters

If there's no Title Slide layout present, you can d

ActivePresentation.AddTitleMaste

In earlier versions of PPT, this adds a new title master. In 2007 it adds a
new Title Slide layout

Now assuming you already have another layout that you want to designate as the
"Title Master", you could, I think, use the above, then copy all of the shapes
from your layout to the new one and you're done.

----------------------------------------
Steve Rindsberg, PPT MV
PPT FAQ: www.pptfaq.co
PPTools: www.pptools.co
================================================

Re: Reset slide layout in VBA (PP2007)
Thanks for this info Steve

Steve Rindsberg wrote:

Thanks Shyam, but I know that I can reapply a layout to a slide.
Thanks Shyam, but I know that I can reapply a layout to a slide. My
question was about doing a "Reset" of a slide (like using tab Home,
group Slides, button Reset). In Office 2007 reapplying a layout and
reseting a slide are two different functionalities

In short, resetting a slide does more than just reapplying a layout. For
example it also sets back the formatting of placeholder shapes (e.g.
font size)

After some more testing, I'm almost certain that no "easy" Reset
function in VBA exists (but maybe I missed something...?). I helped
myself now by creating a procedure that copies the formatting of all
placeholders in the custom layout to their respective shapes objects on
the slide.

Thanks anyway for all help.


Shyam Pillai wrote:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Free Online Courses Available for Eggheadcafe.com Users
http://www.eggheadcafe.com/tutorial...8-fc3cf6855293/free-online-courses-avail.aspx
 
Joined
Jan 12, 2016
Messages
2
Reaction score
0
Setting the slide's CustomLayout object to the one used by that slide only resets the positions and sizes of placeholders and not the formatting. It's possible to write code to get the formatting from the slide's custom layout but it's quite complex because layout placeholder collections are not indexed the same way they are on slides. So, this is a quicker way to do it by using the native PowerPoint Reset Slide UI feature:

Code:
Public Sub ResetAllSlides()
  Dim oSld As Slide
  Dim lCurSlide As Long
  lCurSlide = ActiveWindow.View.Slide.SlideIndex

  For Each oSld In ActivePresentation.Slides
    ActiveWindow.View.GotoSlide oSld.SlideIndex
    DoEvents
    CommandBars.ExecuteMso ("SlideReset")
  Next

  ActiveWindow.View.GotoSlide lCurSlide
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top