Office Word Programming >> Move table column to far right

by stevewy » Wed, 06 Sep 2006 19:50:56 GMT

If I have a selection of rows in the middle of a table and I want a
macro to move them downwards so that they are the last rows in the
table, no matter how big the table is, I can do this with VBA:

NumRows = Selection.Tables(1).Rows.Count
For K = 1 To NumRows
Selection.Range.Relocate wdRelocateDown
Next K

But if I have a column selected and want to move it to the far right of
the table, so it becomes the last column, how can I achieve this easily
in VBA? There does not appear to be a wdRelocateRight or Left
command....

Steve Wylie



Office Word Programming >> Move table column to far right

by Cindy M. » Wed, 06 Sep 2006 21:05:49 GMT


> If I have a selection of rows in the middle of a table and I want a
You'd have to use Selection.Cut, then select the end of the table and
Selection.Paste. Very roughly

Dim rw as Word.Row
Dim nrCells as Long
Set rw = tbl.Rows(1)
nrCells = rw.Cells.Count
rw.Cells(nrCells).Select
Selection.MoveRight wdCharacter, 1, false
Selection.Paste

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)




Office Word Programming >> Move table column to far right

by stevewy » Wed, 06 Sep 2006 21:48:24 GMT


Thanks Cindy, I'll give it a go.



Similar Threads

1. How do I stop a word from separating and moving to the far right - Word Document management

2. Whole doc (with table) moves to the right

Ie used Word since v 4 but I don know what going on here at all.

I have a doc with a table (multiple columns, multiple rows). Suddenly,
if I make any change to the contents or width of any column,
_everything_ (the table and paragraphs above and below) moves slightly
to the right. Make enough changes in the table and it goes right off
the edge of the page.

The margin lines stay where they are; the contents of the page simply
move away from the left line, as if hewing to an invisible line. The
Ruler shows no signs of any indentation. Style does not show any
changes. In Paragraph, I find that some cells in the middle of the
table are listed as having a -0.04 for the right margin; changing that
to 0 does not help (but neither does it move the table and graphs). I
did do some pasting into cells, which is probably where that -0.04 came
from, but why would that move everything on the page?

Ie saved as an RTF. Doesn help.

So I hope somebody here knows the answer.

Thanks!

-- 
voyager

3. In table, add column to the right, but then can't size it

4. Word separating to the far right

How do I stop a word from separating to the far right away from the previous 
word
I ask this question previously but I could not access the answer provided.  
Junior

5. lines shifted further to the right

6. Formatting Mark Space "dot" between words is too far to the right

We use MS Word 2000 running on W2K SP4 with Gill Sans Light
TTF as our corporate font.  When showing formatting marks -
in particular spaces which should show as a dot half way
between the words - the dot is all the way to the right in
the space, almost on top of the first character of the next
word so that you can't really see the space formatting mark
at all.  It doesn't happen with the normal Times Roman etc
which all display properly, but does with certain other
fonts: Book Antiqua, Century Gothic, Garamond, etc.  This
means you can't see how many spaces there are between each
word.  Does anyone have a solution?

7. Page Number Not Extending Out to Far Right - MS Word

8. MS word 2003 table problem moving column lines (could do in '98)

Problem moving column lines in MS word 2003 table (could do it easily in 
prior word).