Table copy and paste

H

HHDM

Hello group

I have a template with a one column table in it.

I have a user-form that pops up, when I create a new document based on
this template.

In the user-form I can make some choices, and according to these I want
to add one or more columns that are stored as one column tables in
separate documents.

What I do is this:

----------------------------------------------------
Word.Documents.Open ("c:\file1.doc")

Word.ActiveDocument.Select

Word.Selection.Copy

Word.ActiveDocument.Close (False)
-------------------------------------------------------


After that I’m going to put in some code for pasting the column – But I
can’t paste it as an additional column, I can only paste into an
existing cell witch mixes everything up, or into another paragraph in
the document, where the column will be ok (but that’s not what I want).

If I open file1.doc and copy/paste manually I can easily add the column
next to the one I have in the document I’m editing.

Does anybody know what I have to do different?

Best regards
Hans-Henrik
 
R

Rob

Sounds like you'll have to do a little manipulation of the cursor with the
code by either moving it or adding a bookmark between the table and the row
marker and going to it before you paste.
 
H

HHDM

I found an alternative solution - just gotta paste before I close the
"source" document.
 
R

Russ

Hans-Henrik,
See recommended change below.
I have a template with a one column table in it.

I have a user-form that pops up, when I create a new document based on
this template.

In the user-form I can make some choices, and according to these I want
to add one or more columns that are stored as one column tables in
separate documents.

What I do is this:
With:
Word.ActiveDocument.Tables(1).Range.Select

You don't want to include the last paragraph mark in the document as part of
the selection (It contains formatting for that section). Then your .copy and
insert column should work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top