Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click oWord = CreateObject("Word.Application") oWord.Visible = True oDoc = oWord.Documents.Add("C:/Template1.dotx") Dim i As Integer = 0 Dim total As Integer = 2 For i = 0 To total If i > 0 Then oDoc.Content.InsertFile("C:/Template1.dotx") End If oDoc.Bookmarks.Item("Bookmark1").Range.Text = i 'For page break Dim oRng As Word.Range oRng = oDoc.Bookmarks.Item("\endofdoc").Range oRng.InsertBreak(Word.WdBreakType.wdPageBreak) Next End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)