【发布时间】:2019-01-28 15:11:57
【问题描述】:
我正在用 VBA 构建一个 Word 文档。我逐行添加一个表格;完成后,我想插入一个空行/段落,然后开始一个新表。但是当我在表格之后添加段落时,插入点出现在段落标记之前,因此下一个表格被添加到那里,并成为第一个表格的一部分。
Set HeaderTableId = WordDoc.Tables.Add(Range:=wrdSel.Range, numcolumns:=3, numrows:=1, AutoFitBehavior:=wdWord9TableBehavior)
Set RowId = HeaderTableId.Rows(1)
RowId.Cells(1) = LeftHeader
RowId.Cells(2).Range.Font.Bold = True
RowId.Cells(3).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
RowId.Cells(2) = CentreHeader
RowId.Cells(3).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
RowId.Cells(3) = RightHeader
' (this table only has one row)
With HeaderTableId.Range
.Collapse (WdCollapseDirection.wdCollapseEnd)
.Move Unit:=wdCharacter, Count:=3
.Select
.InsertParagraph
End With
最后的 .InsertParagraph 在表格之后正确插入了一个空白段落,但插入点在段落标记之前。 我也试过插入分页符,但它有同样的问题。我不知道如何将插入点移到末尾。
【问题讨论】: