How to convert all text boxes to the "(body)" font?

I

IanW

Using PPT 2207, and trying to standardize a whole set of large PPT decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the "(body)" font
of a font theme so that any future changes can be implemented simply via
themes?

Thanks in advance!

--Ian
 
E

Echo S

You can use Replace Font. It's on the Home tab -- way on the far right in
the Replace dropdown. It doesn't specify which is the "heading" or "body"
font from the theme, though, and I agree with you that tying to the theme is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?
 
I

IanW

Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks up all
other incidental uses of the original font (e.g. titles, footers, etc); it
does not affect italics; and as you point out, does not provide the "(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace Font
method in code to get the desired result.

--Ian


Echo S said:
You can use Replace Font. It's on the Home tab -- way on the far right in
the Replace dropdown. It doesn't specify which is the "heading" or "body"
font from the theme, though, and I agree with you that tying to the theme is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


IanW said:
Using PPT 2207, and trying to standardize a whole set of large PPT decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the "(body)"
font
of a font theme so that any future changes can be implemented simply via
themes?

Thanks in advance!

--Ian
 
E

Echo S

It doesn't affect italics? Really? I'll have to look at that!

Maybe one of the coders will pop in with ideas.

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


IanW said:
Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks up
all
other incidental uses of the original font (e.g. titles, footers, etc); it
does not affect italics; and as you point out, does not provide the
"(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace Font
method in code to get the desired result.

--Ian


Echo S said:
You can use Replace Font. It's on the Home tab -- way on the far right in
the Replace dropdown. It doesn't specify which is the "heading" or "body"
font from the theme, though, and I agree with you that tying to the theme
is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


IanW said:
Using PPT 2207, and trying to standardize a whole set of large PPT
decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the "(body)"
font
of a font theme so that any future changes can be implemented simply
via
themes?

Thanks in advance!

--Ian
 
J

John Wilson

See if this code helps

Sub allchange()
'2007 version
Dim osld As Slide, oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.PlaceholderFormat.Type = 7 Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
..Name = "Arial"
..Size = 24
..Color.RGB = RGB(255, 0, 0)
..Bold = msoFalse
..Italic = msoFalse
..Shadow = False
End With
End If
Next oshp
Next osld
End Sub

How to use
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html#vba
--

Amazing PPT Hints, Tips and Tutorials

http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

email john AT technologytrish.co.uk


IanW said:
Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks up all
other incidental uses of the original font (e.g. titles, footers, etc); it
does not affect italics; and as you point out, does not provide the "(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace Font
method in code to get the desired result.

--Ian


Echo S said:
You can use Replace Font. It's on the Home tab -- way on the far right in
the Replace dropdown. It doesn't specify which is the "heading" or "body"
font from the theme, though, and I agree with you that tying to the theme is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


IanW said:
Using PPT 2207, and trying to standardize a whole set of large PPT decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the "(body)"
font
of a font theme so that any future changes can be implemented simply via
themes?

Thanks in advance!

--Ian
 
I

IanW

I'm really close now, but this is my first time into the PPT object model,
and I'm pretty weak at VBA.

To my surprise, I did manage to cobble together this macro, which *almost*
does it:

Sub ChangeTextBoxFont()
For Each pptSlide In ActivePresentation.Slides
For Each pptShape In pptSlide.Shapes
If pptShape.HasTextFrame Then
If pptShape.TextFrame.HasText Then
With pptShape.TextFrame.TextRange.Font
.Name =
ActivePresentation.SlideMaster.TextStyles(ppBodyStyle).TextFrame.TextRange.Font.Name
.Italic = False
.Bold = False
End With
End If
End If
Next
Next
End Sub

The remaining (and critical) task it to have the font actually *be* the
"(Body)" font rather then just set the name of the font to be the same as the
name as the "(Body)" font, which is what the code above does.

Put another way, my macro just hard-codes the font to whatever is the
current "(Body)" font, but does not keep that association to the theme.

Any experts in the VBA object model who can get me over this last but
critical hump?

(http://msdn.microsoft.com/en-us/library/bb251500.aspx)

Thanks,
Ian


Echo S said:
It doesn't affect italics? Really? I'll have to look at that!

Maybe one of the coders will pop in with ideas.

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


IanW said:
Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks up
all
other incidental uses of the original font (e.g. titles, footers, etc); it
does not affect italics; and as you point out, does not provide the
"(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace Font
method in code to get the desired result.

--Ian


Echo S said:
You can use Replace Font. It's on the Home tab -- way on the far right in
the Replace dropdown. It doesn't specify which is the "heading" or "body"
font from the theme, though, and I agree with you that tying to the theme
is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


Using PPT 2207, and trying to standardize a whole set of large PPT
decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the "(body)"
font
of a font theme so that any future changes can be implemented simply
via
themes?

Thanks in advance!

--Ian
 
I

IanW

Thanks very much, John. If I read the code correctly it will have the same
issue that I was stuck on in my post a few minutes ago - i.e. establishing
the link to the "(Body)" font in the current theme.

However, I'll try yours out, as it might lead me down a different path that
the one I was stuck on.

--Ian

John Wilson said:
See if this code helps

Sub allchange()
'2007 version
Dim osld As Slide, oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.PlaceholderFormat.Type = 7 Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 24
.Color.RGB = RGB(255, 0, 0)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
Next oshp
Next osld
End Sub

How to use
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html#vba
--

Amazing PPT Hints, Tips and Tutorials

http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

email john AT technologytrish.co.uk


IanW said:
Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks up all
other incidental uses of the original font (e.g. titles, footers, etc); it
does not affect italics; and as you point out, does not provide the "(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace Font
method in code to get the desired result.

--Ian


Echo S said:
You can use Replace Font. It's on the Home tab -- way on the far right in
the Replace dropdown. It doesn't specify which is the "heading" or "body"
font from the theme, though, and I agree with you that tying to the theme is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


Using PPT 2207, and trying to standardize a whole set of large PPT decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the "(body)"
font
of a font theme so that any future changes can be implemented simply via
themes?

Thanks in advance!

--Ian
 
E

Echo S

PPT/VBA's alleged Help provides little but a few code examples that don't


Well, poop.

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


Steve Rindsberg said:
Something tells me that the answer hinges on accessing the ThemeFonts
collection, but
PPT/VBA's alleged Help provides little but a few code examples that don't
work.

If you can work out how to get a valid reference to the Themefonts
collection, let us
know.

IanW said:
Thanks very much, John. If I read the code correctly it will have the
same
issue that I was stuck on in my post a few minutes ago - i.e.
establishing
the link to the "(Body)" font in the current theme.

However, I'll try yours out, as it might lead me down a different path
that
the one I was stuck on.

--Ian

John Wilson said:
See if this code helps

Sub allchange()
'2007 version
Dim osld As Slide, oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.PlaceholderFormat.Type = 7 Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 24
.Color.RGB = RGB(255, 0, 0)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
Next oshp
Next osld
End Sub

How to use
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html#vba
--

Amazing PPT Hints, Tips and Tutorials

http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

email john AT technologytrish.co.uk


:

Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks
up all
other incidental uses of the original font (e.g. titles, footers,
etc); it
does not affect italics; and as you point out, does not provide the
"(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace
Font
method in code to get the desired result.

--Ian


:

You can use Replace Font. It's on the Home tab -- way on the far
right in
the Replace dropdown. It doesn't specify which is the "heading" or
"body"
font from the theme, though, and I agree with you that tying to the
theme is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


Using PPT 2207, and trying to standardize a whole set of large
PPT decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the
"(body)"
font
of a font theme so that any future changes can be implemented
simply via
themes?

Thanks in advance!

--Ian

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
 
I

IanW

Poop indeed!

I even tried to use the macro recorder in Word to see what happens when I
choose the body font to format text, but sadly it just sets the .Name to the
font name :-(

I get the feeling that I'm way too deep in the object model at the font's
..Name and need to back out a few steps ... but to where??

Here is the "state of the art" so far, with two ways to get that same font
..Name, but no connection to the objective of having it be recognized as a
"(body)" font.

Sub ChangeTextBoxFont()
For Each pptSlide In ActivePresentation.Slides
For Each pptShape In pptSlide.Shapes
If pptShape.HasTextFrame Then
If pptShape.TextFrame.HasText Then
With pptShape.TextFrame.TextRange.Font
'The next line works but does not keep the association to
the Body style
'.Name =
ActivePresentation.SlideMaster.TextStyles(ppBodyStyle).TextFrame.TextRange.Font.Name

'The next line also works but does not keep the association
to the Body style
.Name =
ActivePresentation.SlideMaster.Theme.ThemeFontScheme.MinorFont.Item(msoThemeLatin).Name

.Italic = False
.Bold = False
End With
End If
End If
Next
Next
End Sub



Echo S said:
PPT/VBA's alleged Help provides little but a few code examples that don't
work.


Well, poop.

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


Steve Rindsberg said:
Something tells me that the answer hinges on accessing the ThemeFonts
collection, but
PPT/VBA's alleged Help provides little but a few code examples that don't
work.

If you can work out how to get a valid reference to the Themefonts
collection, let us
know.

IanW said:
Thanks very much, John. If I read the code correctly it will have the
same
issue that I was stuck on in my post a few minutes ago - i.e.
establishing
the link to the "(Body)" font in the current theme.

However, I'll try yours out, as it might lead me down a different path
that
the one I was stuck on.

--Ian

:

See if this code helps

Sub allchange()
'2007 version
Dim osld As Slide, oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.PlaceholderFormat.Type = 7 Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 24
.Color.RGB = RGB(255, 0, 0)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
Next oshp
Next osld
End Sub

How to use
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html#vba
--

Amazing PPT Hints, Tips and Tutorials

http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

email john AT technologytrish.co.uk


:

Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks
up all
other incidental uses of the original font (e.g. titles, footers,
etc); it
does not affect italics; and as you point out, does not provide the
"(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace
Font
method in code to get the desired result.

--Ian


:

You can use Replace Font. It's on the Home tab -- way on the far
right in
the Replace dropdown. It doesn't specify which is the "heading" or
"body"
font from the theme, though, and I agree with you that tying to the
theme is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


Using PPT 2207, and trying to standardize a whole set of large
PPT decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the
"(body)"
font
of a font theme so that any future changes can be implemented
simply via
themes?

Thanks in advance!

--Ian

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
 
J

John Wilson

Hi Steve

I can't reference the themefonts but maybe it would be possible to use
..pickup on a correctly formatted placeholder and then .apply on all the body
placeholders?
--

Amazing PPT Hints, Tips and Tutorials

http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

email john AT technologytrish.co.uk


Steve Rindsberg said:
Something tells me that the answer hinges on accessing the ThemeFonts collection, but
PPT/VBA's alleged Help provides little but a few code examples that don't work.

If you can work out how to get a valid reference to the Themefonts collection, let us
know.

Thanks very much, John. If I read the code correctly it will have the same
issue that I was stuck on in my post a few minutes ago - i.e. establishing
the link to the "(Body)" font in the current theme.

However, I'll try yours out, as it might lead me down a different path that
the one I was stuck on.

--Ian

John Wilson said:
See if this code helps

Sub allchange()
'2007 version
Dim osld As Slide, oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.PlaceholderFormat.Type = 7 Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 24
.Color.RGB = RGB(255, 0, 0)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
Next oshp
Next osld
End Sub

How to use
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html#vba
--

Amazing PPT Hints, Tips and Tutorials

http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

email john AT technologytrish.co.uk


:

Thank you Echo.

A good suggestion - but its not quite going to work for me. It picks up all
other incidental uses of the original font (e.g. titles, footers, etc); it
does not affect italics; and as you point out, does not provide the "(body)"
version of the font as a choice. :-(

I'll look into the code option - perhaps we can leverage the Replace Font
method in code to get the desired result.

--Ian


:

You can use Replace Font. It's on the Home tab -- way on the far right in
the Replace dropdown. It doesn't specify which is the "heading" or "body"
font from the theme, though, and I agree with you that tying to the theme is
what you want in the long run.

I'd bet this is doable in code, though. Would that be an option?

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PPT 2007? http://www.echosvoice.com/2007.htm
Fixing PowerPoint Annoyances http://tinyurl.com/36grcd
PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx


Using PPT 2207, and trying to standardize a whole set of large PPT decks
which contain a lot of ad-hoc text boxes.

Is there a way to convert all text boxes in a PPT file to the "(body)"
font
of a font theme so that any future changes can be implemented simply via
themes?

Thanks in advance!

--Ian

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
 
J

John Wilson

Possible code (not tried as I don't have 2007 here)

Sub bodyswap()
'2007 only!
Dim oshp As Shape
Dim osld As Slide
Dim ocust As CustomLayout
Set ocust = ActivePresentation.SlideMaster.CustomLayouts(2)
ActivePresentation.Slides.AddSlide 1, ocust
With ActivePresentation.Slides(1).Shapes(2)
..PickUp
End With
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoPlaceholder Then
If oshp.PlaceholderFormat.Type = 7 Then
oshp.Apply
End If
End If
Next oshp
Next osld
ActivePresentation.Slides(1).Delete
End Sub

--

Amazing PPT Hints, Tips and Tutorials

http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

email john AT technologytrish.co.uk
 
I

IanW

Thanks very much gentlemen!! I'm tending other fires right now, and will
post back with the results once I can try this out.

--Ian
 
I

IanW

Brilliant! Thanks a ton, Steve.

I had retreived some font names and glanced quickly at things like "+mj-lt"
and assumed they were uninitialized gobbledegook. It all makes sense now.

Thanks again,
Ian
 
I

IanW

Unfortunately, even after a lot of experimentation I can't re-create it. (grrr)

What I can say is that it was not pulled out of the XML. I was trying
different places in the object model (and at times experimentally putting in
indices like 0,1,2,3 rather than the ppXXX or msoYYY constants). My
recollection is that it was something like one of these below (which DO NOT
do it) -- it is possible I may not have used .Name:

MsgBox
(ActivePresentation.SlideMaster.Theme.ThemeFontScheme.MinorFont.Item(1).Name)
MsgBox
(ActivePresentation.SlideMaster.Theme.ThemeFontScheme.MajorFont.Item(1).Name)
MsgBox
(ActivePresentation.Slides(1).Shapes.Title.TextFrame2.TextRange.Font.Name)
MsgBox
(ActivePresentation.Slides(1).Master.Theme.ThemeFontScheme.MajorFont.Item(msoThemeLatin).Name)
MsgBox
(ActivePresentation.Slides(1).Shapes.Title.TextFrame.TextRange.Font.Name)
MsgBox
(ActivePresentation.Slides(1).Shapes.Placeholders.Item(1).TextFrame.TextRange.Font.Name)

Sorry I could not be of more help here.

--Ian
 

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