如何将单词表添加到新页面

时间:2019-09-30 01:44:25

标签: vba ms-access ms-word

我正在尝试使用访问记录创建一封持续进行的信函,并将其放入一个巨大的word文档中。为此,我需要在新页面上添加新字母的开头,并将内容存储在表中。我通过下面的代码了解到,它在内容的末尾添加了新表,但是无论我怎么尝试都不起作用,我希望有人能启发一下代码,以便从下一页开始?

谢谢!

Sub CopyTableToEnd(wd As Word.Document, oWordTbl As Object, w As Word.Application)

    Dim rngTableTarget As Word.Range

    Set rngTableTarget = wd.Content

    rngTableTarget.Start = wd.Content.End

    rngTableTarget.FormattedText = oWordTbl.Range.FormattedText

End Sub

1 个答案:

答案 0 :(得分:0)

尝试一下:

Sub CopyTableToEnd(wd As Word.Document, oWordTbl As Object, w As Word.Application)

   Dim rngTableTarget As Word.Range

   Set rngTableTarget = wd.Content

   rngTableTarget.Start = wd.Content.End

   rngTableTarget.InsertBreak Type:=wdPageBreak

   rngTableTarget.FormattedText = oWordTbl.Range.FormattedText

End Sub