【问题标题】:Insert text with center align插入居中对齐的文本
【发布时间】:2022-01-06 00:07:13
【问题描述】:

我使用此方法添加文本,但它在左侧对齐。 如何使其成为文档中心?

With ActiveDocument.Content
    .InsertAfter "hello world!"
End With

【问题讨论】:

标签: vba ms-word


【解决方案1】:

新的段落是文档的最后一个>>使用.paragraphs.last

Sub test()

With ActiveDocument.Content
    .InsertParagraphAfter     'to be safe that new content is on its own para = last para of document
    .InsertAfter "hello world!"
    .Paragraphs.Last.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
End With

End Sub
``

【讨论】:

  • 它工作。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-27
  • 2015-07-29
  • 2017-11-10
  • 2014-01-28
相关资源
最近更新 更多