0

How to copy a word table multiple times to a specific place using VB.Net 2010?

I have viewed the other responses and these seem just not to work.

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

3
Contributors
2
Replies
9
Views
3 Years
Discussion Span
Last Post by PerplexedB
0

HI,
With Visual Basic I have had the same problem. May I suggest and I am not sure it will work but creating an array to store the data may solve your situation. It worked for me in a simular situation :-).

0

Have you thought of entering a blank line after you copy so that the next table would be in a separate paragraph?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.