Solved

Programatically Select table cells in word

Posted on 2006-06-14
3
334 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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