Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA Word formatting Selection.typetext

I am still a beginner with this. Can you tell my why this is not formatting the selection?

Selection.TypeText "title"

With Selection

        .Font.Bold = True
        .Font.Name = "Arial"
        .Font.ColorIndex = wdDarkBlue
        .ParagraphFormat.Alignment = wdAlignParagraphCenter
        .ParagraphFormat.SpaceAfter = 0
End With
like image 299
ShadyBaker Avatar asked Nov 15 '12 15:11

ShadyBaker


1 Answers

It does format the text, but only text added after the With Selection command.

Change the order, put Selection.TypeText "title" last, and it will work. :)

like image 87
Olle Sjögren Avatar answered Sep 28 '22 06:09

Olle Sjögren