2012-11-15 58 views
4

我还是一个初学者。你能告诉我为什么这不是格式化选择?VBA Word格式化Selection.typetext

Selection.TypeText "title" 

With Selection 

     .Font.Bold = True 
     .Font.Name = "Arial" 
     .Font.ColorIndex = wdDarkBlue 
     .ParagraphFormat.Alignment = wdAlignParagraphCenter 
     .ParagraphFormat.SpaceAfter = 0 
End With 

回答

4

它确实格式化文本,但的With Selection命令后仅文本添加

改变顺序,把Selection.TypeText "title"最后,它会工作。 :)