Solved

Programatically Select table cells in word

Posted on 2006-06-14
3
335 Views
Last Modified: 2010-04-30
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
Comment
Question by:DrDamnit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 total points
ID: 16908006
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
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 16908796
for i=firstcol+1 to lastcol
       activedocument.tables(0).cell(currentrow, i).merge activedocument.tables(0).cell(currentrow, firstcol)
next i
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16966890
Thanks for closing the question.

BFN,

fp.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question