I have a table that i'm trying to use as a template that I can then copy to a new page.

i only got this much

Dim oWord As word.Application
        Dim oDoc As word.Document
        Dim oTable As word.Table


        FileCopy("C:/1535.doc", "C:/1535_1" & ".doc")

        oWord = New word.Application
        oDoc = oWord.Documents.Open("C:/1535_1" & ".doc")


        oDoc.Activate()

        oTable = oDoc.Tables(1)
        
        
        oWord.Selection.GoTo(word.WdGoToItem.wdGoToLine, word.WdGoToDirection.wdGoToLast, Nothing, Nothing)
        oWord.Selection.InsertBreak(word.WdBreakType.wdPageBreak)
        


        oDoc.Save()
        oDoc.Close()
        oWord.Quit()

So i want to get a copy of oTable then after the page break it makes a new page but i don't know how go to that page and put a copy of oTable.

I ended making it work heres the code just in case anyone wants it in the future

Dim oWord As word.Application
        Dim oDoc As word.Document
        Dim oTable As word.Table
 

oTable = oDoc.Tables(1) ' 
oWord.Selection.Tables(1).Select() 'selects your table(template)
oWord.Selection.Copy() 'makes a copy of your template

do while start<end ' your loop to add as many tables you want
       'Your code to edit your table


         'after edit table
           oWord.Selection.Tables(1).Select() ' Selects the table 
           oWord.Selection.MoveDown(word.WdUnits.wdLine, 1)'moves after the table

           oWord.Selection.InsertBreak(word.WdBreakType.wdPageBreak) 'inserts new page
           oWord.Selection.PasteAndFormat(word.WdRecoveryType.wdPasteDefault) 'pastes the original table(template)

start=start+1
loop
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.