VBA code to set two different font sizes in a textframe

  • Thread starter Thread starter Dale Fye
  • Start date Start date
D

Dale Fye

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?
 
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?

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
 
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?

each textframe has only one fint.size property per rendering
 
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
 
Back
Top