Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VBA code to set two different font sizes in a textframe

562 views
Skip to first unread message

Dale Fye

unread,
Nov 23, 2009, 10:57:03 AM11/23/09
to
I'm using Access VBA to build a series of data driven slides, and want the
Title in one of the slides to contain a line of text that has font.size = 36,
and the font.size on the following like to 18).

The code I'm using right now looks like:
oShape.TextFrame.TextRange.Font.Size = 36
oShape.TextFrame.TextRange = "First Line" & vbcrlf & "Second line"

How can I modify this code to accomplish my goal?

----
Dale

mcnewsxp

unread,
Nov 23, 2009, 11:34:10 AM11/23/09
to

each textframe has only one fint.size property per rendering

David Marcovitz

unread,
Nov 23, 2009, 11:33:35 AM11/23/09
to
On 11/23/09 10:57 AM, in article
6A847D01-8C77-4402...@microsoft.com, "Dale Fye"
<dale...@nospam.com> wrote:

Off the top of my head, it would be something like:

OShape.TextFrame.TextRange.Paragraphs(2).Font.Size = 18
OShape.TextFrame.TextRange.Paragraphs(1).Font.Size = 36

I seem to recall that this can be a bit tricky in that sometimes changing
the last line affects other lines (which is why I did the last line first),
but I might be remembering.

--David
--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland


John Wilson

unread,
Nov 23, 2009, 11:37:01 AM11/23/09
to
Does this work Dale?
With ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange
.Text = "This is the text" & vbCrLf & "This is the other text"
.Lines(1).Font.Size = 36
.Lines(2).Font.Size = 18
End With
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

Steve Rindsberg

unread,
Nov 23, 2009, 2:58:39 PM11/23/09
to
In article <4ce6fac8-dd55-43d9-be28-

That's technically correct but not relevant.

You can set the text font properties for a textframe.textrange to change all
of the text in the textframe, but you can also change the font properties of
each *character* in a text frame's text if you like.

Dale Fye

unread,
Nov 23, 2009, 3:22:01 PM11/23/09
to
Thanks, John.

Worked like a charm.

----
Dale

0 new messages