PowerPoint 2007 TextStyle

P

Pete

Hi,

In PowerPoint 2007, is there any way to force a shape's TextFrame object to
use the "Body" TextStyle instead of the "Default" TextStyle? Specifically I
want to programmatically add a shape to a slide with a TextFrame and have the
bullet levels match those set in the master for placeholders rather than the
default.

Thanks in advance,

Pete
 
S

Steve Rindsberg

Hi,

In PowerPoint 2007, is there any way to force a shape's TextFrame object to
use the "Body" TextStyle instead of the "Default" TextStyle? Specifically I
want to programmatically add a shape to a slide with a TextFrame and have the
bullet levels match those set in the master for placeholders rather than the
default.

Y'know those answers you get sometimes that make you smack your head and go "Oh,
jeez, that was SO obvious. Why didn't I SEE that??"

This isn't one of those. Nobody would ever have guessed this one:

Working with text in PowerPoint 2007 (VBA)
http://www.pptfaq.com/FAQ00957.htm
 
P

Pete

Well, you're absolutely right - I wouldn't have guessed that. I've learned
something new so thank you for that Steve. What I'm really interested in is
the TextStyle property of the Master: this in turn has a Levels property
containing a TextStyleLevels collection and the TextStyleLevel objects define
the font, color, size and bullet shape of the text when you increase or
decrease the indent. You set this up in the master and when you type text in
a native placeholder, add bullets then indent, your formatting is applied
automatically to each indent level. Not so when you add text to a Textbox or
if you programmatically add a shape with a TextFrame. Your custom formatting
(which I believe is stored in the "Body" TextStyle) is not automatically
applied. Setting the Font.Name property of the TextFrame to "+mn" will
override the font style but not the bullets, color or size. You can, of
course, set any of these properties programmatically for the current level
but as soon as the user indents/outdents it reverts to the default formatting.

Any ideas?

Thanks,

Pete
 
S

Steve Rindsberg

Well, you're absolutely right - I wouldn't have guessed that. I've learned
something new so thank you for that Steve. What I'm really interested in is
the TextStyle property of the Master: this in turn has a Levels property
containing a TextStyleLevels collection and the TextStyleLevel objects define
the font, color, size and bullet shape of the text when you increase or
decrease the indent. You set this up in the master and when you type text in
a native placeholder, add bullets then indent, your formatting is applied
automatically to each indent level. Not so when you add text to a Textbox or
if you programmatically add a shape with a TextFrame.

Correct. Only text in placeholders follows the master slide's text formatting.
Your custom formatting
(which I believe is stored in the "Body" TextStyle) is not automatically
applied. Setting the Font.Name property of the TextFrame to "+mn" will
override the font style but not the bullets, color or size. You can, of
course, set any of these properties programmatically for the current level
but as soon as the user indents/outdents it reverts to the default formatting.

Text in textboxes/shapes with textframes has always been a bit of a disconnect for
PPT. The best advice I can give you is to fill the text box with bogus text, at
least one line at each indent level, apply the formatting you want, then delete any
text you no longer need.

Then the formatting holds ... generally ... if the user adds and indents text. But
they have to use the Indent button from the outline view; tabbing doesn't work.
 
P

Pete

Hi Steve,

Thanks again for your time. That's a great idea and worth a try. Doesn't
seem to work unfortunately. The Shape only seems to remember the last
formatting you applied: so if the user indents, it keeps the same colour and
bullet character rather than stepping through a sequence of formats. I'm
starting to think it's not going to be possible to get a shape to act like a
placeholder.

Pete
 
S

Steve Rindsberg

Hi Steve,

Thanks again for your time. That's a great idea and worth a try. Doesn't
seem to work unfortunately. The Shape only seems to remember the last
formatting you applied: so if the user indents, it keeps the same colour and
bullet character rather than stepping through a sequence of formats. I'm
starting to think it's not going to be possible to get a shape to act like a
placeholder.

Oh, I can promise you that much <g>

I had to go back and prod at our ShapeStyles add-in for PPT to work out what we do there
(it's an addin that brings Word=like styles to PPT ...
http://www.pptools.com/shapestyles/ )

Seems I was mistaken. In fact, our add-in can't even force it to behave this way, but it
can record the desired formatting and *after* the user's entered their text and done the
indents, apply the appropriate indents, bullet format and so on.
 
J

Joe Colgan

Hi Pete & Steve,

I'm very new to VBA (only started learning it 2 weeks ago) and this is my
first post to a forum like this so I hope there are no major errors in what
I'm posting. Nevertheless, in case you're interested, I had the same problem
and solved it like this...

I first copied the text placeholder from the slide master which had the
"levels" formatting I wanted to replicate in a non-placeholder Text Box:

ActivePresentation.SlideMaster.Shapes(2).Copy

I then used "Paste Special as shape" to insert it onto the current slide,
being sure I attached a name to the shape so I can move & adjust formatting
later:

ActiveWindow.Selection.SlideRange.Shapes.PasteSpecial(ppPasteShape).Name =
varName

I then moved the shape and slightly adjusted the formatting

With ActiveWindow.Selection.SlideRange.Shapes(varName)
.left = left
.top = rowTop
.width = width
.height = height
.TextEffect.FontSize = 12
End With

This is where I stopped but I presume you can use the AutoShapeType property
to change the "pasted placeholder" to whichever shape you want (Chevron,
Pentagon, etc).

Instead of formatting a shape like a placeholder I copied the placeholder
and changed it to the shape I wanted (in this case a text box)

I hope this makes sense.

Joe
 
S

Steve Rindsberg

While this wouldn't fit every need, it's a *VERY* neat way of solving the problem.
Thanks for posting it, Joe.
 

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