Solved

Programatically Select table cells in word

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now