Moving out of a table, problem

M

Mike

Hi! I am experiencing a peculiar problem with moving selection out of Word
table.

I get a document which has a table in the beginning. When I open the file
manually the cursor is blinking in front of the first character inside the
table. I need to insert a couple of line before the table. What happens
instead is I get those lines INSIDE the table.
I tried to do this:

object objUNIT = Word.WdUnits.wdLine;
object objEXTEND = Word.WdMovementType.wdMove;
object objCOUNT = 1;

mySel.InsertParagraph();
mySel.MoveUp(ref objUNIT, ref objCOUNT, ref objEXTEND);

What am I doing wrong ? How would you do it in C#, VB-6 or VBA?

I also seem unable to insert 2 lines in front of embedded tables, images,
files.
What's the general rule on how to do it ?


Thank you in advance,

--Michael
 
H

Helmut Weber

Hi Michael,

Selection.SplitTable

with the insertion point somewhere in the first row.
 
M

Mike

For the sake of completion, the following code worked in all situations not
just tables:

Selection.HomeKey wdStory
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=1, Name:=""
ActiveDocument.Bookmarks("\page").Select
Selection.Cut
Selection.HomeKey wdStory
Selection.range.ListFormat.RemoveNumbers
Selection.TypeText "WHATEVER " & vbCrLf
Selection.Paste
 

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