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
Helmut Weber - 31 Jan 2006 08:48 GMT
Hi Michael,
Selection.SplitTable
with the insertion point somewhere in the first row.
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Mike - 31 Jan 2006 21:31 GMT
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
> Hi Michael,
>
[quoted text clipped - 7 lines]
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000