Drago
Drago

Reputation: 101

How to change the font of a selection in powerpoint 2013 with VBA

I would like to to change for the text selection in powerpoint 2013 the font to be bold and "Couirier New". I tried with this VBA script to change the font:

Sub chengeFont()
    With ActiveDocument.Selection
        With .Font
            .Name = "Courier New"
        End With
    End With
End Sub

but it is not working. Any suggestions?

Upvotes: 1

Views: 509

Answers (1)

Mr.Burns
Mr.Burns

Reputation: 700

This will change the font and make it bold when you run it

With ActiveWindow.Selection.TextRange.Font
    .Name = "Courier New"
    .Bold = msoTrue
End With

Since you are running it from a selection the document will should always be the active one, other wise you will need to change the ActiveWindow

Upvotes: 2

Related Questions