Show a CustomLayout on PowerPoint 2007/10 using VBA

Hi,

My application uses several layouts. To make it easy for users to modify these layouts, I want to navigate to the correct layout used by the slide currently shown. On PowerPoint that would be clicking on View | Slide Master and then selecting the correct layout from the list on the slides panel.

My code would look something like:

' Get current slide layout used
Set myLayout = ActiveWindow.View.Slide.CustomLayout
' Show the slide master
ActiveWindow.ViewType = ppViewSlideMaster
' Select the layout
...

Open in new window


Apparently the View or Window object do not have a way to select a particular layout and assigning myLayout to ActiveWindow.View.Slide crashes PowerPoint (not surprising since it is expecting a slide, nor a layout). So, how do you do it.

Thank you ver much in advance.
momsoft2Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JSRWilsonConnect With a Mentor Commented:
Not sure I understand, doesn't Powerpoint auto select the custom layout currently in use when you go to Master view?

You can click the button in code like his:

Application.CommandBars.ExecuteMso ("ViewSlideMasterView")
0
 
momsoft2Author Commented:
JSRWilson,

That was it. You are absolutely right. I wasn't aware of the ExecuteMso method. It is certainly a life saver.

Thank you very much.
0
All Courses

From novice to tech pro — start learning today.