• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

Programatically Select table cells in word

I am creating a table (oTable) and filling it up with information, adding rows, populating info, etc...

How do I programatically select cells 3,4 - 3,8 for the purposes of merging them? (Incidentally, 3,4- 3,8 is arbitrary. It could be any cell range on the same row.)
0
DrDamnit
Asked:
DrDamnit
  • 2
1 Solution
 
[ fanpages ]IT Services ConsultantCommented:
Once you have the first cell of the table selected...

    Selection.MoveRight Unit:=wdCharacter, Count:=3
    Selection.MoveDown Unit:=wdLine, Count:=4

    Selection.MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend


Basically, you MoveRight with Unit:=wdCharacter to go across columns, and MoveDown with Unit:=wdLine to go down rows.

Then add the Extend:=wdExtend option to select to the point where you move to.

BFN,

fp.

0
 
Vadim RappCommented:
for i=firstcol+1 to lastcol
       activedocument.tables(0).cell(currentrow, i).merge activedocument.tables(0).cell(currentrow, firstcol)
next i
0
 
[ fanpages ]IT Services ConsultantCommented:
Thanks for closing the question.

BFN,

fp.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now