Click here to Skip to main content
15,878,748 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to copy a word table multiple times to a specific place using VB.Net 2010?

I am working on a VB.Net 2010 program using the Interop class.

We are having problems trying to duplicate a table more than 1 time to be put in the place we want.

It is either merging it with the original table in the Word Doc or putting it into the next table.

Is there a clear explanation on how a table can be duplicated 2-3 times?

It copies the first table fine but the 2nd is inserted into the table following the original table.


Imports Word = Microsoft.Office.Interop.Word
...
We are currently using functions as:
MyCopyFromRange.Select()
MyCopyFromRange.Copy()

Rng = MyCopyFromRange
Rng.SetRange(MyCopyFromRange.End, MyCopyFromRange.End)

For MyCnt = 1 To pNoOf
WordApp.Selection.InsertAfter(MySepStr) ' not then it appends to the DevTable

WordApp.Selection.MoveDown() ' Move down needed if not appends to origina table

WordApp.Selection.Paste() ' Manual paste works without the move down this does not. It puts it in the next table
..
Next
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900