Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / June 2007

Tip: Looking for answers? Try searching our database.

Defining Slide Layout in VBA using a variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
koldkompress@gmail.com - 05 Jun 2007 11:21 GMT
Hi all,

I'm using VBA to parse an XML file into a powerpoint.  I've got an
attribute on my Slide node called "layout".  When I come to create a
slide I use this code:

' For each subject within the presentation
   For Each SubjNode In PresNode.childNodes

       ' For each slide within that subject..
       For Each SlideNode In SubjNode.childNodes

           'Create that slide
           Set PPSlide = PPPres.Slides.Add(PPPres.Slides.Count + 1,
SlideNode.getAttribute("layout"))

If you note the last line of code, it has the slides.add with the
layout attribute from the SlideNode.  However, I get a "Type Mismatch"
even though a Debug.Print SlideNode.getAttribute("layout") displays
the correct layout (ppLayoutText)

Thanks

Michael
Chirag - 05 Jun 2007 13:02 GMT
getAttribute() returns a string but the second argument to Slides.Add() is
an enum or an int. You need to convert the ppLayout* constants that you get
as string to their int values and pass it as second argument.

- Chirag

 PowerShow - View multiple PowerPoint slide shows simultaneously
 http://officeone.mvps.org/powershow/powershow.html

> Hi all,
>
[quoted text clipped - 20 lines]
>
> Michael
KoldKay - 05 Jun 2007 13:28 GMT
> getAttribute() returns a string but the second argument to Slides.Add() is
> an enum or an int. You need to convert the ppLayout* constants that you get
[quoted text clipped - 35 lines]
>
> - Show quoted text -

Hey Chirag,

Thanks, that's really done the trick.  All I have to do now is figure
out all the numerical IDs and then use my database to convert them.

Thanks again

Michael
KoldKay - 05 Jun 2007 14:07 GMT
> > getAttribute() returns a string but the second argument to Slides.Add() is
> > an enum or an int. You need to convert the ppLayout* constants that you get
[quoted text clipped - 46 lines]
>
> - Show quoted text -

I know I'm replying to myself, but if anyone needs references for
these, here's my rough guide:

1 = Title with subtitle
2 = title + text
3 = Title + Two Text
4 = Title + Table
5 = Title + text + chart
6 = Title + Chart + Text
7 = Title + Diagram
8 = Title + Chart
9 = Title + text + Clipart
10 = Title + Clipart + Text
11 = Title [At top] only
12 = Blank
13 = Title + text + content
14 = Title + Content + text
15 = Large Content
16 = Title + Content
17 = Title + Text + Media Clip
18 = Title + Media Clip + Text
19 = Title + Content + text
20 = Title + Text + Content
21 = Title + Text + Content + Content
22 = Title + Content + Content + text
23 = Title + Content + Content + Text [Vertical]
24 = Title + Content + Content + Content + Content
25 = Title + Side Text
26 = Title + Clipart + Side Text
27 = Side Title + Side Text
28 = Side Title + Sidetext + Chart
29 = Title + Content + Content
30 = Title + Content + Small content + Small Content
31 = Title + Small Content + small Content + Content

Thanks

Michael
Chirag - 05 Jun 2007 15:22 GMT
>> > getAttribute() returns a string but the second argument to Slides.Add()
>> > is
[quoted text clipped - 84 lines]
> 30 = Title + Content + Small content + Small Content
> 31 = Title + Small Content + small Content + Content

These are documented at (look for PpSlideLayout):
http://msdn2.microsoft.com/en-us/library/aa211582(office.11).aspx

Microsoft Office PowerPoint 2007 introduces a few more:
ppLayoutCustom = 32
ppLayoutSectionHeader  33
ppLayoutComparison = 34
ppLayoutContentWithCaption = 35
ppLayoutPictureWithCaption = 36

- Chirag

 PowerShow - View multiple PowerPoint slide shows simultaneously
 http://officeone.mvps.org/powershow/powershow.html

> Thanks
>
> Michael
Kathy Jacobs - 05 Jun 2007 15:30 GMT
You know... One of us should mark this down and send it Mr. Rindsberg so
that it gets FAQed... Awe - heck - I am just going to email it to him and
hope he sees it.

Signature

Kathy Jacobs,  Microsoft MVP  OneNote and PowerPoint
Author of Kathy Jacobs on PowerPoint
Get PowerPoint and OneNote information at www.onppt.com

I believe life is meant to be lived. But:
if we live without making a difference, it makes no difference that we lived

>> > getAttribute() returns a string but the second argument to Slides.Add()
>> > is
[quoted text clipped - 88 lines]
>
> Michael
Steve Rindsberg - 11 Jun 2007 04:58 GMT
> You know... One of us should mark this down and send it Mr. Rindsberg so
> that it gets FAQed... Awe - heck - I am just going to email it to him and
> hope he sees it.

Ah, so that's what the email was about.  Gotcha.

The constant values are all available in the object browser in VBA though.  
I'd think most programmers would know that.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Kathy Jacobs - 11 Jun 2007 20:29 GMT
Yeah - that was what the email was about. And then I had a bad allergic
reaction to some candy second half of last week and never got back to you to
explain. You might think that most programmers would know that, but I
didn't. Then again, whether I am still a programmer or not is best left as a
question for the future to decide. :)
Signature

Kathy Jacobs,  Microsoft MVP  OneNote and PowerPoint
Author of Kathy Jacobs on PowerPoint
Get PowerPoint and OneNote information at www.onppt.com

I believe life is meant to be lived. But:
if we live without making a difference, it makes no difference that we lived

> In article <4F7E7683-6C71-4727-B3E2-3E60007E2C34@microsoft.com>, Kathy
> Jacobs
[quoted text clipped - 13 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 11 Jun 2007 23:50 GMT
> Yeah - that was what the email was about. And then I had a bad allergic
> reaction to some candy second half of last week and never got back to you to
> explain. You might think that most programmers would know that, but I
> didn't. Then again, whether I am still a programmer or not is best left as a
> question for the future to decide. :)

Whatever you are, you're one of em what knows to use the object browser now
though. <g>

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.