• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

TextFrame object in powerpoint 2013, different fonts from VBA

I've got a TextFrame object in a powerpoint slide.  I'd like to manipulate the object through VBA but it has different font sizes in the text.
SNAG-0010.bmpHow can I select a piece of text and apply a different font to it using VBA code?
0
AndyAinscow
Asked:
AndyAinscow
1 Solution
 
Rgonzo1971Commented:
Hi,
pls try

Sub macro()

Set s = ActiveWindow.Selection
Set chars = s.ShapeRange.TextFrame.TextRange.Characters
For Each char In chars
    If char.Start <= 5 Then
        char.Font.Size = 22
    Else
        char.Font.Size = 35
    End If
Next
End Sub
'Or

Sub macro1()

Set s = ActiveWindow.Selection
s.ShapeRange.TextFrame.TextRange.Font.Size = 35
s.ShapeRange.TextFrame.TextRange.Characters(1, 5).Font.Size = 22
End Sub

Open in new window

Regards
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
The second works, I've not tried the first.
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now