Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PowerPoint Macro Change Custom Layout

Posted on 2008-10-07
6
Medium Priority
?
2,597 Views
Last Modified: 2013-11-27
I need to be able to find the Layout Name in PowerPoint so I can reference it in a VB Script.

I will be using the following code:
ActiveWindow.Selection.SlideRange.Layout = ppLayout"LAYOUT NAME"

I have built custom layouts in PowerPoint 2007 based upon the original layouts.  For example I took the 'Blank' Template and renamed it 'Navigation' and changed the colors/fonts/etc.  

When I try to change the layout of the current slide to the new Navigation layout with the following code I get a debug error (Slide Unknown: Invalid enumeration value)::
ActiveWindow.Selection.SlideRange.Layout = ppLayoutNavigation

When I enter the the following code, I am able to change my current slide layout to the new Navigation layout
ActiveWindow.Selection.SlideRange.Layout = ppLayoutBlank

It appears even though I have renamed the Blank Layout to Navigation it is still coded as Blank in order to reference it in script.  I have numerous slide layouts with new names, and I am not sure what the appropriate code name to use is.  

Does anyone know how to find out the name of the layout to use in the macro?  It is not as simple of checking the name of the slide layout in the Slide Master.
0
Comment
Question by:EAI_Chief
  • 4
  • 2
6 Comments
 
LVL 21

Expert Comment

by:GlennaShaw
ID: 22661565
0
 

Author Comment

by:EAI_Chief
ID: 22662475
I need to reference the Custom Name for the Custom Layout
0
 
LVL 21

Expert Comment

by:GlennaShaw
ID: 22662760
http://msdn.microsoft.com/en-us/library/bb231180.aspx

Should return your customlayout name
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Assisted Solution

by:GlennaShaw
GlennaShaw earned 400 total points
ID: 22662788
0
 

Accepted Solution

by:
EAI_Chief earned 0 total points
ID: 22757552
I was not able to successful call a specific custom layout, so I created a macro that would automatically add a text box that would cover the navigation i was trying to get rid of.
0
 
LVL 21

Expert Comment

by:GlennaShaw
ID: 22757876
This didn't help?:
Working with Slides
A presentation contains one or more slides; these are represented as a Slides collection within each Presentation object.
Adding a slide takes a few lines of code, and you will need to work around some of the peculiarities of the Office PowerPoint automation model. To add a slide, you need to specify a custom layout. The custom layouts are stored in the presentation master and differ, depending on the presentation template. For expediency, we just choose the first custom layout in the master. After creating the slide by using the custom master, you can set the final intended layout by using the Slide.Layout method with any of the 37 slide layouts that are found in the PpSlideLayout enumeration:

Dim objSlide As PowerPoint.Slide
Dim objCustomLayout As PowerPoint.CustomLayout
objCustomLayout = objPres.SlideMaster.CustomLayouts.Item(1)
objSlide = objPres.Slides.AddSlide(1, objCustomLayout)
objSlide.Layout = PowerPoint.PpSlideLayout.ppLayoutTitleOnly
 
http://msdn.microsoft.com/en-us/library/bb251512.aspx
http://msdn.microsoft.com/en-us/library/bb251279.aspx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question